4 ms·
Just for curiosity sake, I looked at the standard RNG in C# and it is indeed flawed, but probably not enough to be seen unless you are doing formal tests. In [
by GuB-42 3y ago
Just for curiosity sake, I looked at the standard RNG in C# and it is indeed flawed, but probably not enough to be seen unless you are doing formal tests.
In [1] it says that numbers have a 0.5034 probability of being odd due to rounding errors in the algorithm that picks a number in a range, which is unacceptable for a simulation, but may actually be better than a real coin toss [2]. The raw RNG is also flawed but not that badly [3]
[1] https://fuglede.dk/en/blog/bias-in-net-rng/ https://fuglede.dk/en/blog/bias-in-net-rng/
[2] https://arxiv.org/abs/2310.04153 https://arxiv.org/abs/2310.04153
[3] https://gist.github.com/fuglede/772402ecc3997ada82a03ce65361781b https://gist.github.com/fuglede/772402ecc3997ada82a03ce65361...
- Semaphor 3y agoOkay, now you made me want actually look into that ;) I should be able to recreate the old code (it was years ago, but I still have the script) and make a comment if I end up actually finding statistical anomalies.
- Semaphor 3y agoIt will have to stay a mystery, looking at distribution, both algorithms looked the same.