Question: Hi, I need help please with writing this code: /** * Generates the hidden code to be guessed by the user. The hidden code *
Hi, I need help please with writing this code:
/** * Generates the hidden code to be guessed by the user. The hidden code * returned is an array of characters with length numPositions. * The characters in the array are randomly chosen, in order starting at index 0, * from the symbols array. * rand.nextInt( symbols.length) * is used to determine the index in the symbols array of each character * in the code. For all arrays, don't assume a length but use the array .length attribute. * * Example: * if numPositions is 3 and symbols is the array {'A','B','C'} * the returned array will have a length of 3 and may contain any selection of * the available symbols such as {'B','C','B'} or {'C','A','B'}. * * @param rand A random number generator. * @param numPositions The number of symbols in the code. * @param symbols The symbols to choose from. * @return An array of length numPositions of randomly chosen symbols. */ public static char[] generateHiddenCode(Random rand, int numPositions, char[] symbols) { return null; //TODO replace
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
