跳转到内容

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.

chance(p): boolean

Defined in: sdk/src/math/random.ts:23

True with probability p (clamped to [0, 1]).

number

boolean


float(): number

Defined in: sdk/src/math/random.ts:19

A float in [0, 1).

number


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.

string | number

Rng


int(min, max): number

Defined in: sdk/src/math/random.ts:21

An integer in [min, max], both included, without modulo bias.

number

number

number


nextU32(): number

Defined in: sdk/src/math/random.ts:17

The next 32 bits as an unsigned integer.

number


pick<T>(items): T

Defined in: sdk/src/math/random.ts:25

One element of a non-empty list.

T

readonly T[]

T


shuffle<T>(items): T[]

Defined in: sdk/src/math/random.ts:29

A shuffled copy; the input is left alone.

T

readonly T[]

T[]


weighted<T>(items, weight): T

Defined in: sdk/src/math/random.ts:27

One element chosen by weight; a weight of 0 never wins.

T

readonly T[]

(item) => number

T