Skip to content

Search

Documentation

random module

The engine's one deterministic PCG32 stream: the same seed draws the same numbers on every platform, and a replay reproduces every draw.

På den här sidan

The engine's one deterministic PCG32 stream: the same seed draws the same numbers on every platform, and a replay reproduces every draw.

5 functions, 0 constants. Scripts reach it as random::.

Functions

Argument kinds are the script values a call passes: node is a node handle, any a table or value of any kind, fn a callback.

function acts on what it does
float() — A float from the deterministic engine stream, uniform in [0, 1).
int(low: int, high: int) — A whole number from the deterministic engine stream, uniform in [low, high], both ends included.
range(low: float, high: float) — A float from the deterministic engine stream, uniform in [low, high): the two arguments.
seed(seed: int) — Restart the deterministic engine stream at the given seed, so every draw after it repeats.
uuid() — A version-4 UUID drawn from the deterministic engine stream, so a replay makes the same ids; not for anything that must be unique across machines.