Generate a random float between two numbers
rrand
[min (number), max (number)]
Given two numbers, this produces a float between the supplied min and max values exclusively. Both min and max need to be supplied. For random integers, see rrand_i
Introduced in v2.0.0
|
print rrand(0, 10) |
#=> will print a number like 8.917730007820797 to the output pane |
|
loop do play rrand(60, 72) sleep 0.125 end |
#=> Will play a random non-integer midi note between C4 (60) and C5 (72) such as 67.3453 or 71.2393 |