Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

random number rails

Use rand(range)

From Ruby Random Numbers:

If you needed a random integer to simulate a roll of a six-sided die, you'd use: 1 + rand(6). A roll in craps could be simulated with 2 + rand(6) + rand(6).

Finally, if you just need a random float, just call rand with no arguments.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #random #number #rails
ADD COMMENT
Topic
Name
6+8 =