Skip to content

Extract state from SplitMix64? #64

@LegionMammal978

Description

@LegionMammal978

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions