Saturday, March 23, 2019

mathematics - Accurately simulating the lots of dice rolls without loops?


OK so if your game rolls lots of dice you can just call a random number generator in a loop. But for any set of dice being rolled often enough you will get a distribution curve/histogram. So my question is there a nice simple calculation I can run that will give me a number that fits that distribution?


E.g. 2D6 - Score - % Probability


2 - 2.77%


3 - 5.55%


4 - 8.33%



5 - 11.11%


6 - 13.88%


7 - 16.66%


8 - 13.88%


9 - 11.11%


10 - 8.33%


11 - 5.55%


12 - 2.77%


So knowing the above you could roll a single d100 and work out an accurate 2D6 value. But once we start with 10D6, 50D6, 100D6, 1000D6 this could save a lot of processing time. So there must be a tutorial / method / algorithm that can do this fast? It is probably handy for stock markets, casinos, strategy games, dwarf fortress etc. What if you could simulate the outcomes of complete strategic battle that would take hours to play with a few calls to this function and some basic maths?




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...