Answers for "get random 5 digits rails"

0

generate 6 digit random number ruby

10.times.map{rand(10)}.join # => "3401487670"
Posted by: Guest on July-23-2020
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