Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NEP 19 — Random number generator policy states that regarding
numpy.random.*
"[the] preferred best practice for getting reproducible pseudorandom numbers is to instantiate a generator object with a seed and pass it around". According to this, the currently used globalRandomState
in numpy can cause problems. Therefore, this pull request proposes replaces it using the numpy random number generators instead.With this pull request, a random number generator (
rng
) object can be passed to thecore
(with a newdefault_rng
generator object as the default argument). It also adds the same argument to thesample
function incubicasa.py
, to theRandomSpawns
class and therandom_empty_positions
function inmodules.py
, theRandomChain
function infsm.py
, and theinit_textures
,wall_pattern
,random_lights
,scenery
functions inscene.py
.In the
RandomSpawns
class (modules.py
), the corerng
is automatically passed to therandom_empty_positions
during initialization. Likewise, therng
object is passed fromscenery
torandom_lights
andinit_textures
, and frominit_textures
towall_pattern
.This way, during environment setup, one can create a single (potentially seeded)
rng
generator object to pass to all subsequent use cases.