Generate a random number from a range inclusive
suggest change# Ruby 1.9.2 and later
lower_limit = 1
upper_limit = 6
Random.new.rand(lower_limit..upper_limit) # .. includes both ends; ... excludes upper_limit
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents