[OT] Generating distribution of N dice rolls
Ali Çehreli
acehreli at yahoo.com
Thu Nov 10 22:18:47 UTC 2022
On 11/10/22 13:45, Siarhei Siamashka wrote:
> (your implementation has a significantly
> higher variance)
Agreed. I didn't think the following "random" values would magically be
correct. :)
// Larger this value, closer the results to normal distribution
enum normalDistributianness = 1000;
// Window around the average of values to pick randomly within
const halfWindow = average / 2;
I was half joking anyway but the values 4_000 and 'average / 20',
respectively produce closer values:
[16663617, 16663620, 16662052, 16671587, 16663818, 16675306]
> . And for comparison, a [Python/SciPy
>
implementation](https://github.com/scipy/scipy/issues/17388#issuecomment-1310913940)
outputs:
>
> [16664115, 16666144, 16677962, 16660692, 16663181, 16667906]
But I am still half joking. :)
Ali
More information about the Digitalmars-d
mailing list