random — Random utilities
Small convenience wrappers around Python's random module.
Exports
random() -> float— uniform 0.0–1.0seed(seed: int) -> None— seed RNGrandint(a: int, b: int) -> int— inclusive random integerchoice(seq: list) -> Any— pick random elementshuffle(seq: list) -> None— in-place shuffleuniform(a: float, b: float) -> float— float in [a, b)randfloat(a: float, b: float) -> float— alias foruniformsample(seq: list, k: int) -> list— k unique elements
Examples
function example() returns null {
random.seed(42);
print(random.randint(1, 6));
let items = [1,2,3,4];
random.shuffle(items);
print(items);
}
Notes
- These functions directly call Python's
randommodule and behave the same way; see Python docs for details on determinism and seeding.