rust-random/rngs

Feature request: Ability to serialize XorShiftRng?

attente opened this issue · 2 comments

I'm trying to use XorShiftRng just as a simple and quick stream of reproducible random bytes (I don't really need cryptographic security for this) and want to be able to serialize it so that I can load it in the same state at a later point in time.

I can't seem to see any way to do this. Would it be okay to submit a PR that adds a conditional Cargo feature that makes XorShiftRng derive serde::Serialize and serde::Deserialize? Or alternatively add something like a to_seed(&self) method that can be used to reconstruct the XorShiftRng via the SeedableRng trait?

Oh, sorry... I just saw in the codebase that it actually is already serde::Serialize and serde::Deserialize. Closing this!

Glad you worked this out yourself (serde1 feature).