random
Pseudorandom number generation, sampling, and shuffling.
Import
import randomFunctions
random.int(min: int, max: int) -> int
Random integer in [min, max], inclusive on both ends.
random.float() -> float
Random float in [0.0, 1.0) (half-open upper bound).
random.bool() -> bool
Random boolean.
random.choice(arr: [any]) -> any
Random element from an array.
random.shuffle(arr: [any])
Shuffle array in-place.
random.sample(arr: [any], n: int) -> [any]
Return n random elements without replacement.
random.seed(n: int)
Set the random seed for reproducible output.
Examples
scratch.xs