rand
rand num
- Returns a random fractional number between
0
and the value of num. (num should be positive.) If num is omitted, the function returns a value between0
and1
(including0
, but excluding1
). See alsosrand
.To get an integral value, combine this with
int
, as in:$roll = int(rand 6) + 1; # $roll is now an integer between 1 and 6