Standard Library: Rand
The Generate random values
Rand.bool()
Get true or false, chosen at random.
Rand.bool()
true
Rand.random()
Get a random fractional number between 0 and
1.
Rand.random()
0.3742091256146767
Rand.range(limit)
Return a random integer between 0 and
limit - 1, inclusive.
Rand.range(10)
8
Rand.sample(values)
Return a random element from values, where
values is a list, table, or set.
Rand.sample(["hearts", "diamonds", "clubs", "spades"])
spades
Rand.shuffle(values)
Shuffles values, where values is a list or table.
Rand.shuffle([1, 2, 3, 4])
[3, 2, 4, 1]
Rand.span(from, to)
Return a random integer between from and
to, inclusive.
Rand.span(1, 10)
5