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
Name | Type |
---|---|
rng | RNG |
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
Name | Type |
---|---|
rng | SerializedRNG |
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
Name | Type |
---|---|
object | unknown |
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
Name | Type |
---|---|
object | unknown |
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
Name | Type | Description |
---|---|---|
seed | Seed | Optional. 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
Name | Type |
---|---|
rng1 | RNG |
rng2 | RNG |
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
Name | Type |
---|---|
rng | RNG |
Returns
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
Name | Type |
---|---|
object | Readonly <Record <string , RNG >> |
seed | Seed |
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
Name | Type |
---|---|
object | Readonly <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
Name | Type |
---|---|
rng | RNG |
seed | Seed |
Returns
void