Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How does Rust do at random number generation? Is there (for example) a crate for seeding random number generators?


I'm not sure if I understand your wording: "a crate for seeding random number generators"? Do you mean, "is there a RNG that you can seed in Rust"?

There's a `rand` crate[0] which I believe was written by folks in the Rust project, though it's not part of std. You can seed the RNG[1].

[0] https://crates.io/crates/rand, https://github.com/rust-random/rand

[1] https://docs.rs/rand/latest/rand/rngs/struct.StdRng.html#met...


Sorry, yes, that's kind of what I meant. Ultimately, I want to be able to seed an RNG with an alphanumeric string, and in other languages that means using a third-party library or writing one myself.


The `rand` crate in Rust is a de facto standard, but it's not an official standard, so that does technically mean trusting a third-party library. A lot of the Rust ecosystem is structured this way, in part because package management with Cargo is convenient.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: