This is what I have so far:
myArray.map!{ rand(max) }
Obviously, however, sometimes the numbers in the list are not unique. How can I mak
You could use a hash to track the random numbers you've used so far:
seen = {} max = 100 (1..10).map { |n| x = rand(max) while (seen[x]) x = rand(max) end x }