On Saturday, 24 December 2022 at 17:55:11 UTC, jwatson-CO-edu wrote:
On Saturday, 24 December 2022 at 16:42:36 UTC, Siarhei Siamashka wrote:

Sounds like a case of https://xkcd.com/221/

BTW, you don't need to explicitly initialize unpredictableSeed,

Another thing is that the current implementation of `std.random` in Phobos is extremely slow

Even better, I automated the caching of dice rolls to be used later as random numbers! `;P`

Just in case if you are not joking, caching a certain amount of dice rolls to reuse them later in a circular fashion would make a bad quality pseudorandom number generator (a slightly upgraded version of the xkcd joke). Don't do this. Just use `std.random` if performance doesn't really matter and you want to avoid an extra library dependency. But if performance does matter and you need hundreds of millions of random numbers for Monte Carlo simulations, fuzz testing or anything else, then consider `mir.random`.

BTW, a few puzzles from https://adventofcode.com/2022 are trivialized by using randomized bruteforce instead of a more sophisticated algorithm. And having fast random numbers generation helps.

Reply via email to