Is it better to use 2 independent random number generators or one array of size 36 that holds the sample space(of all possible sums) and use one random number generator to choose from this arry.
Which is more precise and why?
Is it better to use 2 independent random number generators or one array of size 36 that holds the sample space(of all possible sums) and use one random number generator to choose from this arry.
Which is more precise and why?
On
The customary implementation would be to just roll each die separately (i.e., call the random number generator twice). There is no mathematical difference, and you don't want to commit to developing a brand-new sample space array for every new set of dice that you're interested in: 3d6 (three 6-sided dice), 5d6, 2d8, 4d6-drop-lowest, etc., etc. Consider this information on the "Troll" (t-roll) dice-rolling laguage specification: http://www.diku.dk/~torbenm/Troll/
The most expensive part of software engineering is programmer time. The best strategy is whatever is quicker, shorter, and easier for future maintainers to read and understand.
There's no difference between randomly choosing two numbers from 1 to 6, then adding them and choosing randomly from an array of 36 possible sums.
There may be a reason to choose one over the other from a programming perspective.