If I have a range of numbers from 0 - 70, I want to pick five random numbers and the sum of random numbers to be higher then 140 and lower then 220. I want to do that until the sum of five random numbers is in the range 140..220, and then display those five random numbers.*
This is what I did so far:
5.times {r=rand (0..70); puts "#{r}"}
or:
5.times {puts "#{[*0...70].sample}"}