random
The engine's one deterministic PCG32 stream: the same seed draws the same numbers on every platform, and a replay reproduces every draw.
On this page
The engine's one deterministic PCG32 stream: the same seed draws the same numbers on every platform, and a replay reproduces every draw.
6 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 |
|---|---|---|
at(int, int) -> float |
— | The indexth number of the stream seed names, uniform in [0, 1): the same for the same two on every platform, and apart from the engine stream, so a tool's layout draws nothing a game would. |
float() -> float |
— | A float from the deterministic engine stream, uniform in [0, 1). |
int(int, int) -> int |
— | A whole number from the deterministic engine stream, uniform in [low, high], both ends included. |
range(float, float) -> float |
— | A float from the deterministic engine stream, uniform in [low, high): the two arguments. |
seed(int) |
— | Restart the deterministic engine stream at the given seed, so every draw after it repeats. |
uuid() -> string |
— | 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. |