I'm new to Ruby. I just want to know if there is a way to create random numbers in the following fashion:
1) Generate 45 random numbers.
2) Random number generated can be repeated only up to 5 times
I tried using the following approach.
45.times do |x|
puts x.rand(1..9)
end
How can I achieve max occurrence of a number be 5?