Question: Using Math.random(), design an algorithm for each of the following prompts: 1. Given an integer array nums, randomly shuffle the array. To shuffle, repeatedly

Using Math.random(), design an algorithm for each of the following prompts: 1. Given an integer array nums, randomly shuffle the array. To shuffle, repeatedly swap the values of two randomly selected elements of the array. int numir = (int)(Math.random() 2. Given a string array names, design an algorithm that randomly selects and prints a name from the array names. String name = (sming) (math.random().
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
