dimanche 24 novembre 2019

How can I generate a deterministic, seeded random number using the rand crate in Rust?

In a Rust project, I want to generate reproducible random numbers based on a integer seed as I'm used to in Java.

The documentation for Seed in the rand crate states:

Seed type, which is restricted to types mutably-dereferencable as u8 arrays (we recommend [u8; N] for some N).

Does this mean an integer seed is not possible? If it is possible, how can I use StdRng with an integral seed?




Aucun commentaire:

Enregistrer un commentaire