[OT] Generating distribution of N dice rolls

Timon Gehr timon.gehr at gmx.ch
Sat Nov 12 21:47:58 UTC 2022


On 11.11.22 14:27, H. S. Teoh wrote:
> On Fri, Nov 11, 2022 at 10:52:47AM +0000, Siarhei Siamashka via Digitalmars-d wrote:
>> On Thursday, 10 November 2022 at 23:15:24 UTC, H. S. Teoh wrote:
>>> Being able to compute a hundred million dice rolls in a split second
>>> is already good enough for what I need. :-D
>>
>> How important for you is to actually have a statistically correct
>> solution for this particular problem?
>>
>> If something is off, then this may be eventually discovered by
>> somebody in the future. Here's one famous example:
>> https://www.wondriumdaily.com/gregor-mendel-fake-data/
> 
> Relax, this isn't for generating fake data. :-D  It's for a simulation,
> and actually my use case mainly involves small values of N. So
> technically I don't need to optimize it to this extent; it's just a
> nice-to-have and a fun exercise to make it resistant to performance
> degradation by unusually large inputs.
> 
> 
> T
> 

I think the question was more: does it matter to you whether or not the 
simulation models an accurate distribution of results? What kind of code 
is consuming those dice roll frequency tables?

Note that even though the results are random, the distribution of 
results itself is not random and can in principle be compared precisely.

It's pretty clear that you are not getting the right distribution, 
although I have not investigated in detail how much what you simulate 
deviates from the true multinomial distribution that you actually 
attempt to simulate. Still, I guess for some use cases, the deviation 
would be significant.


More information about the Digitalmars-d mailing list