RNG
Type Aliases
Section titled “Type Aliases”SerializedRNG
Section titled “SerializedRNG”SerializedRNG =
Readonly<LuaMap<string,unknown>> &object
Defined in: packages/isaacscript-common/src/functions/rng.ts:12
Type Declaration
Section titled “Type Declaration”__serializedRNGBrand
Section titled “__serializedRNGBrand”
readonly__serializedRNGBrand:symbol
__kind
Section titled “__kind”
readonly__kind:CopyableIsaacAPIClassType.RNG
Functions
Section titled “Functions”copyRNG()
Section titled “copyRNG()”copyRNG(
rng):RNG
Defined in: packages/isaacscript-common/src/functions/rng.ts:29
Helper function to copy an RNG Isaac API class.
Parameters
Section titled “Parameters”RNG
Returns
Section titled “Returns”RNG
deserializeRNG()
Section titled “deserializeRNG()”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.)
Parameters
Section titled “Parameters”Returns
Section titled “Returns”RNG
getRandomSeed()
Section titled “getRandomSeed()”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.
Returns
Section titled “Returns”Seed
isRNG()
Section titled “isRNG()”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.
Parameters
Section titled “Parameters”object
Section titled “object”unknown
Returns
Section titled “Returns”object is RNG
isSerializedRNG()
Section titled “isSerializedRNG()”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.
Parameters
Section titled “Parameters”object
Section titled “object”unknown
Returns
Section titled “Returns”object is SerializedRNG
newRNG()
Section titled “newRNG()”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.
Parameters
Section titled “Parameters”Seed = ...
Optional. The seed to initialize it with. Default is a random seed.
Returns
Section titled “Returns”RNG
rngEquals()
Section titled “rngEquals()”rngEquals(
rng1,rng2):boolean
Defined in: packages/isaacscript-common/src/functions/rng.ts:100
Parameters
Section titled “Parameters”RNG
RNG
Returns
Section titled “Returns”boolean
serializeRNG()
Section titled “serializeRNG()”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.)
Parameters
Section titled “Parameters”RNG
Returns
Section titled “Returns”setAllRNGToSeed()
Section titled “setAllRNGToSeed()”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.
Parameters
Section titled “Parameters”object
Section titled “object”ReadonlyRecord<string, RNG>
Seed
Returns
Section titled “Returns”void
setAllRNGToStartSeed()
Section titled “setAllRNGToStartSeed()”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.
Parameters
Section titled “Parameters”object
Section titled “object”ReadonlyRecord<string, RNG>
Returns
Section titled “Returns”void
setSeed()
Section titled “setSeed()”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.
Parameters
Section titled “Parameters”RNG
Seed
Returns
Section titled “Returns”void
