How to generate a random number between a and b in Ruby?

To generate a random number between 3 and 10, for example, I use: rand(8) + 3

Is there a nicer way to do this (something like rand(3, 10)) ?

8 Answers
8

Leave a Comment