NVIDIA Interview Question

A function generates uniform random numbers? how will you use it to print all the elements of the array randomly?

Interview Answers

Anonymous

Feb 26, 2013

So that can be implemented by making the size of the random number generation equal to the size of the array and then print all the numbers at the indexes generated by the function. Is this right?

Anonymous

May 1, 2014

List list = new ArrayList(); for(int i = 1; i <= 100; i++) list.add(i); Collections.shuffle(list);