Skip to main content

RNG

Type Aliases

SerializedRNG

Ƭ SerializedRNG: LuaMap<string, unknown> & { __serializedRNGBrand: symbol ; __kind: CopyableIsaacAPIClassType.RNG }

Defined in

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

Functions

copyRNG

copyRNG(rng): RNG

Helper function to copy an RNG Isaac API class.

Parameters

NameType
rngRNG

Returns

RNG

Defined in

packages/isaacscript-common/src/functions/rng.ts:28


deserializeRNG

deserializeRNG(rng): RNG

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.)

Parameters

NameType
rngSerializedRNG

Returns

RNG

Defined in

packages/isaacscript-common/src/functions/rng.ts:43


getRandomSeed

getRandomSeed(): Seed

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.

Returns

Seed

Defined in

packages/isaacscript-common/src/functions/rng.ts:65


isRNG

isRNG(object): object is RNG

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

Parameters

NameType
objectunknown

Returns

object is RNG

Defined in

packages/isaacscript-common/src/functions/rng.ts:72


isSerializedRNG

isSerializedRNG(object): object is SerializedRNG

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

Parameters

NameType
objectunknown

Returns

object is SerializedRNG

Defined in

packages/isaacscript-common/src/functions/rng.ts:80


newRNG

newRNG(seed?): RNG

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

Parameters

NameTypeDescription
seedSeedOptional. The seed to initialize it with. Default is a random seed.

Returns

RNG

Defined in

packages/isaacscript-common/src/functions/rng.ts:93


rngEquals

rngEquals(rng1, rng2): boolean

Parameters

NameType
rng1RNG
rng2RNG

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rng.ts:99


serializeRNG

serializeRNG(rng): SerializedRNG

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.)

Parameters

NameType
rngRNG

Returns

SerializedRNG

Defined in

packages/isaacscript-common/src/functions/rng.ts:107


setAllRNGToSeed

setAllRNGToSeed(object, seed): void

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.

Parameters

NameType
objectReadonly<Record<string, RNG>>
seedSeed

Returns

void

Defined in

packages/isaacscript-common/src/functions/rng.ts:125


setAllRNGToStartSeed

setAllRNGToStartSeed(object): void

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.

Parameters

NameType
objectReadonly<Record<string, RNG>>

Returns

void

Defined in

packages/isaacscript-common/src/functions/rng.ts:154


setSeed

setSeed(rng, seed): void

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

Parameters

NameType
rngRNG
seedSeed

Returns

void

Defined in

packages/isaacscript-common/src/functions/rng.ts:164