Skip to content

Way to read seed in order to replay next time with it #43

Open
@a-voronov

Description

Hi!
I'm about to use RandomKit for unit-testing.
Is there any way to save current seed and be able to create generator with the same seed next time in order to reproduce tests with same generated values?

Something like this, but not to do whole thing every time.

let x = UInt64.random(using: &Xoroshiro.default) // 10836192520054005588
let y = UInt64.random(using: &Xoroshiro.default) // 11819366441135859839

var r = Xoroshiro(seed: (x, y))
let z = UInt64.random(using: &r)                 // 4208814887480313811

So basically, for Xoroshiro, it would be exposing _state variable for read-only purposes.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions