Originally Posted by
Meetch1972
If the internal random number generator is really doing random(6) + random(6) + random(6) for 3d6, you could possibly use... *drum roll* a bunch of lookup tables! If you want a statistically equivalent method to simulate Xd6 (up to 5x or 6x, this will work) Simple mechanism: 1d6 is straightforward. 2d6 would use a lookup table with 36 combination (2,3,3,4,4,4,5,5,5,5,6,6,6,6,6,7,7,7,7,7,7,8,8,8,8 ,8,9,9,9,9,10,10,10,10,11,11,12) (or 1+1,1+2,2+1,1+3,2+2,3+1 etc).
Then access that lookup table with a single random(36) index on it - this time I "rolled a 3", which causes a lookup on the third element in the array, or that second three. Would it be faster? That's up to the developers and the pre-existing behind-the-scenes code. The array would grow to 216 elements for 3d6, over 1296 for 4d6, an array of a whole 7776 bytes for 5d6 and so on. But as I understand a single random lookup of arbitrary size indexing a static array could be far more efficient than 2 or more random(6) operations. You'll get the statistical equivalence with a single random() call. Of course you'll need to allow for all the major combos, but if you limited to 5d6 then statistically adding a pair of 5d6 lookups would do the trick and give statistically equivalent results. Does this make sense? Plus some d4, d8, d10, d12, and maybe even d20 multiples as appropriate could all take the load off the random number generator.