Skip to content

Rng beta ​

Class of @v12-engine/engine

ts
export declare class Rng

Small seeded PRNG (mulberry32). The simulation never touches Math.random so runs are reproducible.

Members ​

constructor ​

ts
constructor(seed: number);

Constructs a new instance of the Rng class

int ​

ts
int(min: number, max: number): number;

Integer in [min, max]

next ​

ts
next(): number;

Float in [0, 1)

range ​

ts
range(min: number, max: number): number;

A float in [min, max), drawn from the sequence

restore ​

ts
restore(state: number): void;

Sets the generator's state to one taken by save, so it goes on with the very same numbers

save ​

ts
save(): number;

Where it is in its sequence, for a save. restore with it carries on with the very same numbers