Rng
Defined in: sdk/src/math/random.ts:15
core-sys.ts
Engine infrastructure surface: platform, lifecycle, logging, diagnostics, timers, entity helpers, networking, screen.
These are the “runs under everything else” primitives that a consuming application might touch (logging, timers, platform detection, runtime config) but that are not directly part of the ECS or render pipeline.
Re-exported wholesale by core.ts.
Methods
Section titled “Methods”chance()
Section titled “chance()”chance(
p):boolean
Defined in: sdk/src/math/random.ts:23
True with probability p (clamped to [0, 1]).
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”boolean
float()
Section titled “float()”float():
number
Defined in: sdk/src/math/random.ts:19
A float in [0, 1).
Returns
Section titled “Returns”number
fork()
Section titled “fork()”fork(
label):Rng
Defined in: sdk/src/math/random.ts:35
An independent generator named label. It derives from the original seed
and the label alone, never from how much this one has drawn, so adding a
draw in one place does not move the numbers of another stream.
Parameters
Section titled “Parameters”string | number
Returns
Section titled “Returns”Rng
int(
min,max):number
Defined in: sdk/src/math/random.ts:21
An integer in [min, max], both included, without modulo bias.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”number
nextU32()
Section titled “nextU32()”nextU32():
number
Defined in: sdk/src/math/random.ts:17
The next 32 bits as an unsigned integer.
Returns
Section titled “Returns”number
pick()
Section titled “pick()”pick<
T>(items):T
Defined in: sdk/src/math/random.ts:25
One element of a non-empty list.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”readonly T[]
Returns
Section titled “Returns”T
shuffle()
Section titled “shuffle()”shuffle<
T>(items):T[]
Defined in: sdk/src/math/random.ts:29
A shuffled copy; the input is left alone.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”readonly T[]
Returns
Section titled “Returns”T[]
weighted()
Section titled “weighted()”weighted<
T>(items,weight):T
Defined in: sdk/src/math/random.ts:27
One element chosen by weight; a weight of 0 never wins.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”readonly T[]
weight
Section titled “weight”(item) => number
Returns
Section titled “Returns”T