-
-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Right now, the only way to extract the state from a SplitMix64 is to serialize it with serde. But actually extracting the value from the serialized data is quite tedious: you can either use bincode to serialize and deserialize it with some level of overhead, or write your own Serializer with a dozen dummy methods. And neither solution is feasible if you're trying to write a project with optional serde support: you'd be better off just copying the SplitMix64 algorithm and writing your own RandCore impl for it.
It would be nice if there were a method to simply extract its u64 state, so that it can later be recreated with seed_from_u64(). My use case is squirreling the RNG state through an external Value enum that can hold numbers, strings, arrays, etc., but not arbitrary Rust objects. And it's not like SplitMix64 is cryptographically secure to begin with, so the state is hardly sensitive data.