Skip to content

Random

Defined in: core/random.ts:104

Randomness available to game code as ctx.random and in setup.

float(): number

Defined in: core/random.ts:108

A float in [0, 1) with 53 bits of randomness.

number


int(maxExclusive): number

Defined in: core/random.ts:106

A uniformly distributed integer in [0, maxExclusive). Unbiased.

number

number


pick<T>(items): T

Defined in: core/random.ts:112

One uniformly chosen item. Throws on an empty array.

T

readonly T[]

T


shuffle<T>(items): T[]

Defined in: core/random.ts:110

A new array with the items in uniformly random order (Fisher-Yates).

T

readonly T[]

T[]