TODO: Set all elements in randoms to be new Random objects. Note that this metho
ID: 3736401 • Letter: T
Question
TODO: Set all elements in randoms to be new Random objects. Note that this method shouldn't return anything. When you pass objects such *as arrays into methods, modifications you do to the object will be visible outside. Even though you don't return anything, you're affecting the array we *gave as a parameter to this method! This is not the case for primatives such *as int or double, although it is true for arrays of rimatives *Mutating inputs like this can lead to unexpected bugs; be careful with it! HINT *Look at numberSpelling to see how to set a value at an index of an array. ak To make a new random object, you can do Random rand -new RandomO You can reference the structure of sum to iterate over the elements of * randoms public static void randomSwarm(Random[ randoms)Explanation / Answer
public static void randomSwarm(Random[] randoms) { for(int i = 0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.