random
Random numbers, picks and shuffles (use seed(n) to repeat them).
import random
Example
import random
random.seed(7)
say(random.int(1, 6))
say(random.choice(["tea", "coffee", "cocoa"]))
say(random.shuffle([1, 2, 3, 4, 5]))
Functions
int(low, high)
returns numberA random whole number from low to high (both included).
number()
returns numberA random number from 0 up to (not including) 1.
choice(list)
returns valueOne item picked at random.
shuffle(list)
returns listA new list with the same items in a random order.
sample(list, n)
returns listn different items picked at random.
seed(n)
Start the random numbers from n, so the program picks the same ones every run.