Monday, June 22, 2015

How to generate a random number in a range in Ruby 2.2.2

rand(0..4)

This will generate random numbers 0 to 4. It is inclusive of the lower and upper bound in the range.