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
Being able to serialise and deserialise PRNG state is a useful attribute for systems that are used in numerical simulations and game replay. Currently there is no safe way to save/restore PRNG state in either "math/rand" or "x/exp/rand" (the only way to do this currently would be to perform an unsafe conversion and save/restore that.
Proposal
I'd like to propose that the rand.PCGSource be given binary encoding/decoding methods. With this, users needing to save/restore PRNG state can either create a new rand.Source by directly constructing the rand.PCGSource and calling the Seed method, leaving them holding the value and so being able to use the serialisation methods, or alternatively type-assert to this type. No additional methods would be needed in rand.Source.
The text was updated successfully, but these errors were encountered:
Happy to do that. What is your preferred serialisation format? Just simple binary? I have been thinking about this for our PRNG package in Gonum where I have been considering including the type since we have more than one, but that seems like overkill for here.
Background
Being able to serialise and deserialise PRNG state is a useful attribute for systems that are used in numerical simulations and game replay. Currently there is no safe way to save/restore PRNG state in either "math/rand" or "x/exp/rand" (the only way to do this currently would be to perform an unsafe conversion and save/restore that.
Proposal
I'd like to propose that the
rand.PCGSource
be given binary encoding/decoding methods. With this, users needing to save/restore PRNG state can either create a newrand.Source
by directly constructing therand.PCGSource
and calling theSeed
method, leaving them holding the value and so being able to use the serialisation methods, or alternatively type-assert to this type. No additional methods would be needed inrand.Source
.The text was updated successfully, but these errors were encountered: