package class1_1_EditingAnArray; import java.util.*; public class RandomMultipleChoice { public static final int NUM_PROBLEMS = 10; public static void main(String[] args) { Scanner in = new Scanner(System.in); Random generator = new Random(); int choices = 8; System.out.println("Enter the number of choices (" +choices+"): "); String line = in.nextLine(); Scanner lineIn = new Scanner(line); if(lineIn.hasNextInt()) { choices = lineIn.nextInt(); } System.out.println("Generating "+NUM_PROBLEMS+" problems with " + choices + " possible choices."); for(int i=0;i bits = new LinkedList(); int rand = generator.nextInt(choices)+1; int bitCount = 0; for(int tmp = choices-1; tmp != 0; tmp >>=1, bitCount++) { // do nothing } for(int tmp = rand-1; tmp != 0; tmp >>= 1) { bits.add(0,(byte) (tmp & 1)); } System.out.print("Problem " + i + ": " + rand+ " ("); for(int j=0; j