Select a random number a random number of times but never the same random number twice
random, ruby, ruby-on-rails
Solution
As a quick one-liner:
rands = (0..10).to_a.shuffle[0, Random.rand(0..10)]
Problem
Possible Duplicate: How do I generate a list of n unique random numbers in Ruby? I want to do: ``` Random.rand(0..10).times do puts Random.rand(0..10) end ``` with the exception that if a random number has already been displayed it cannot be displayed again. How do I do this most easily?