Comment by JKCalhoun

19 days ago

Damn good. Does it matter that you're (presumably) using a psuedo random number? I mean you seem to nail the probabilities regardless.

Perhaps our pseudorandom algorithms are better at flipping a coin (this case) versus having to choose a random value over a range greater than 2 (or "1" if you like).

It should not be a problem, pseudorandom numbers are used in simulations, like monte-carlo, all the time.

Nim uses xoroshiro[0] algorithm for std/random module and it produces good quality statistically random bits until 5TB of output. And lower 4 bits have a little bias, but it should not matter as we only use upper 64 out of available 128 bits.

Also, I just now realise that xoroshiro-128+ is really cheap, so perhaps my batching optimisation was unnecessary here.

[0] - https://en.wikipedia.org/wiki/Xorshift#xoroshiro