Answers for "random method in rails"

0

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.
Posted by: Guest on September-03-2021

Browse Popular Code Answers by Language