MotionScript

@motion-script/core


@motion-script/core / SeedGenerator

Class: SeedGenerator

Defined in: util/random.ts:9

Deterministic pseudo-random number generator based on the mulberry32 algorithm. Produces the same sequence for the same seed, making animations reproducible.

This is the low-level engine. Scene authors use the higher-level Random facade (handed out by stage.random(seed)), which wraps a SeedGenerator and adds typed draws (nextFloat/nextInt/gauss/arrays) plus seeded noise.

Constructors

Constructor

new SeedGenerator(seed): SeedGenerator

Defined in: util/random.ts:12

Parameters

seed

string | number

Returns

SeedGenerator

Methods

next()

next(): number

Defined in: util/random.ts:27

Returns the next pseudo-random float in [0, 1).

Returns

number


setSeed()

setSeed(seed): void

Defined in: util/random.ts:20

Resets the generator to a new seed. String seeds are hashed via djb2 into a 32-bit integer.

Parameters

seed

string | number

Returns

void