You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Separate seed and state in PolyMath random number generators #337
Several random number generators in PolyMath currently use a single instance variable, seed, both as the initial seed provided by the user and as the internal state of the generator.
The root of the issue is that PMPseudoRandomNumberGenerator defines only a single slot:
While this behavior reflects the internal implementation of the generators, it is somewhat surprising from an API perspective. Users often expect seed to represent the value used to initialize the generator and therefore remain unchanged throughout its lifetime.
The Random class of Pharo already makes this distinction explicit:
Introduce a state slot in PMPseudoRandomNumberGenerator and use it as the mutable internal state of the generator, while preserving seed as the original initialization value. Change the random number generation algorithms to operate on state, while keeping seed unchanged.
Activity