Skip to content

RNG

SerializedRNG = Readonly<LuaMap<string, unknown>> & object

Defined in: packages/isaacscript-common/src/functions/rng.ts:12

readonly __serializedRNGBrand: symbol

readonly __kind: CopyableIsaacAPIClassType.RNG

copyRNG(rng): RNG

Defined in: packages/isaacscript-common/src/functions/rng.ts:29

Helper function to copy an RNG Isaac API class.

RNG

RNG


deserializeRNG(rng): RNG

Defined in: packages/isaacscript-common/src/functions/rng.ts:44

Helper function to convert a SerializedRNG object to a normal RNG object. (This is used by the save data manager when reading data from the “save#.dat” file.)

SerializedRNG

RNG


getRandomSeed(): Seed

Defined in: packages/isaacscript-common/src/functions/rng.ts:66

Helper function to get a random Seed value to be used in spawning entities and so on. Use this instead of calling the Random function directly since that can return a value of 0 and crash the game.

Seed


isRNG(object): object is RNG

Defined in: packages/isaacscript-common/src/functions/rng.ts:73

Helper function to check if something is an instantiated RNG object.

unknown

object is RNG


isSerializedRNG(object): object is SerializedRNG

Defined in: packages/isaacscript-common/src/functions/rng.ts:81

Used to determine is the given table is a serialized RNG object created by the deepCopy function.

unknown

object is SerializedRNG


newRNG(seed?): RNG

Defined in: packages/isaacscript-common/src/functions/rng.ts:94

Helper function to initialize a new RNG object using Blade’s recommended shift index.

Seed = ...

Optional. The seed to initialize it with. Default is a random seed.

RNG


rngEquals(rng1, rng2): boolean

Defined in: packages/isaacscript-common/src/functions/rng.ts:100

RNG

RNG

boolean


serializeRNG(rng): SerializedRNG

Defined in: packages/isaacscript-common/src/functions/rng.ts:108

Helper function to convert a RNG object to a SerializedRNG object. (This is used by the save data manager when writing data from the “save#.dat” file.)

RNG

SerializedRNG


setAllRNGToSeed(object, seed): void

Defined in: packages/isaacscript-common/src/functions/rng.ts:126

Helper function to iterate over the provided object and set the seed for all of the values that are RNG objects equal to a particular seed.

ReadonlyRecord<string, RNG>

Seed

void


setAllRNGToStartSeed(object): void

Defined in: packages/isaacscript-common/src/functions/rng.ts:157

Helper function to iterate over the provided object and set the seed for all of the values that are RNG objects equal to the start seed for the current run.

ReadonlyRecord<string, RNG>

void


setSeed(rng, seed): void

Defined in: packages/isaacscript-common/src/functions/rng.ts:167

Helper function to set a seed to an RNG object using Blade’s recommended shift index.

RNG

Seed

void