Crate evaluation for 2017-07-25: rand

Thanks for the links @joshlf; you provide a very good argument against usage of user-space PRNGs by default.

It might therefore make sense if thread_rng() just uses OsRng (which, on some platforms, requires initialisation just to work out how to access the OS rng), and let programmers who really want a user-space PRNG set up their own.

For cryptographic applications, this seems fine (to me; I may be missing something). For anything requiring reproducibility, there is a requirement to handle initialisation of the PRNG yourself anyway. For other non-cryptographic uses (e.g. randomised algorithms and simple games), this story is a little unfortunate, since each random number now needs a system call, unless the programmer goes to the effort of setting up a PRNG. This isn’t really that difficult, however.

1 Like