Module necro.game.system.RNG
Functions
choice (table, channel) | Chooses a seeded random entry from the specified table. |
float (limit, channel) | |
getDungeonSeed () | |
int (limit, channel) | Generates a seeded random integer between 0 (inclusive) and the specified limit (excluding the limit itself). |
range (lower, upper, channel) | Generates a seeded random integer between the lower and upper limit, including both limit values themselves. |
roll (probability, channel) | Performs a seeded random check, returning true with the specified probability (between 0 and 1), or false otherwise. |
seed (r1, r2, r3, channel) | Overrides the current RNG state with the specified seed values. |
shuffle (list, channel) | Shuffles the given list in-place (Fisher-Yates) Channel parameter: see rng.int |
Tables
Channel |
Functions
- choice (table, channel)
-
Chooses a seeded random entry from the specified table.
Channel parameter: see rng.int
Parameters:
- table
- channel
- float (limit, channel)
-
Parameters:
- limit
- channel
- getDungeonSeed ()
- int (limit, channel)
-
Generates a seeded random integer between 0 (inclusive) and the specified limit (excluding the limit itself).
If an entity with the "random" component is specified, the entity-specific RNG state is used.
If a number is specified, the corresponding consistency channel is used.
Otherwise, level-global random state is used. The latter is more prone to visual discontinuities during rollback.
Parameters:
- limit
- channel
- range (lower, upper, channel)
-
Generates a seeded random integer between the lower and upper limit, including both limit values themselves.
Channel parameter: see rng.int
Parameters:
- lower
- upper
- channel
- roll (probability, channel)
-
Performs a seeded random check, returning true with the specified probability (between 0 and 1), or false otherwise.
Channel parameter: see rng.int
Parameters:
- probability
- channel
- seed (r1, r2, r3, channel)
-
Overrides the current RNG state with the specified seed values.
Parameters:
- r1
- r2
- r3
- channel
- shuffle (list, channel)
-
Shuffles the given list in-place (Fisher-Yates)
Channel parameter: see rng.int
Parameters:
- list
- channel