random
The random module provides random number generation and selection.
Functions
random.randint(min, max)
Returns a random integer between min and max (inclusive).
random.randfloat()
Returns a random float between 0.0 (inclusive) and 1.0 (exclusive).
random.choice(list)
Returns a random element from a list.
Throws an error if the list is empty.
random.char(string)
Returns a random character from a string.
Throws an error if the string is empty.
random.shuffle(list)
Shuffles a list in place. Returns nil.
Full example
import console
import random
function main() {
// simulate rolling two dice
var int d1 = random.randint(1, 6)
var int d2 = random.randint(1, 6)
console.println("Rolled: " + d1.tostring() + " + " + d2.tostring() + " = " + (d1 + d2).tostring())
// pick a random item
var list prizes = ["gold", "silver", "bronze"]
console.println("You won: " + random.choice(prizes))
}