-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to resume a PRNG, at a later time deterministically? #1
Comments
As a workaround I've implemented a method for a PcgEngine<IType,...> impl<Itype, Xtype, MulMix, OutMix> PcgEngine<Itype, Xtype, SpecificSeqStream<Itype>, MulMix, OutMix>
where Itype: PcgOps + BitSize + Clone,
Xtype: PcgOps + BitSize,
MulMix: Multiplier<Itype>,
OutMix: OutputMixin<Itype, Xtype>,
SpecificSeqStream<Itype>: Stream<Itype>,
PcgEngine<Itype, Xtype, SpecificSeqStream<Itype>, MulMix, OutMix>: Rng
{
pub fn extract_seed(&self) -> [Itype; 2] {
[self.state.clone(), self.stream_mix.get_stream()]
}
} I'm not sure, if your interested in adding something like this also for the other subtypes? In the long run, it would be probably wise to add something like |
Also see rust-random/rand#84. |
@fkjogu sorry for not getting back to you. These past few months have been a whirlwind involving moving and starting a new job. I like this idea, I toyed with serializing the generators in the "serde" branch. If you don't have time, I will get around to implementing it myself sometime soon hopefully. |
This enables to extract the state of the PRNG and resume its state by reseeding. Issue robojeb#1
How can I access and save the state in a way, that I can resume the pseudo random number generator at a later time?
The text was updated successfully, but these errors were encountered: