Tutorial by Examples

# Roll a 6 sided die, rand(6) returns a number from 0 to 5 inclusive dice_roll_result = 1 + rand(6)
# ruby 1.92 lower_limit = 1 upper_limit = 6 Random.new.rand(lower_limit..upper_limit) # Change your range operator to suit your needs

Page 1 of 1