[OT] Generating distribution of N dice rolls
Siarhei Siamashka
siarhei.siamashka at gmail.com
Thu Nov 10 21:45:56 UTC 2022
On Thursday, 10 November 2022 at 17:46:59 UTC, Ali Çehreli wrote:
> On 11/10/22 08:57, H. S. Teoh wrote:
>
> > if there's a fast way to
> > compute the standard deviation of the multinomial
>
> I am happy with my solution which includes scientific terms
> like normalDistributianness. :p
>
> [...]
>
> Error checking etc. are missing but hundred million dice throws
> in a split second... Now that's fast! :p
That's fast, but unfortunately doesn't seem to be correct. Your
code outputs something like this:
[16548205, 16741274, 16600777, 16792301, 16585808, 16731635]
While the original slow reference H. S. Teoh's implementation
outputs:
[16669388, 16665882, 16668019, 16671186, 16664718, 16660807]
It's easy to see even with a naked eye that the statistical
properties are obviously not the same (your implementation has a
significantly higher variance). And for comparison, a
[Python/SciPy
implementation](https://github.com/scipy/scipy/issues/17388#issuecomment-1310913940) outputs:
[16664115, 16666144, 16677962, 16660692, 16663181, 16667906]
More information about the Digitalmars-d
mailing list