Skip to content

Latest commit

 

History

History
18 lines (12 loc) · 385 Bytes

random_number_generator_in_ruby.md

File metadata and controls

18 lines (12 loc) · 385 Bytes

Random number generator in ruby:

We can generate random number using the rand keyword.

We can pass an argument to rand to generate a number starting from zero up to (but not including) that number.

puts rand 90
#Output: 77

And for generating random number within any range, we can use rand lower..upper like below

puts rand 100..200
#Output: 109