Sum of roll of N dice
|
05-02-2018, 12:03 PM
Post: #8
|
|||
|
|||
RE: Sum of roll of N dice
(05-02-2018 07:01 AM)Jim Horn Wrote: If you roll N six sided dice and put them next to each other and write down the values they show *minus 1* each, you'll get an N digit integer in base 6. All such 6^N integers are equally likely for fair dice. So, just find a random number from 0 to (6^N)-1, convert to base 6, add the sum of its digits plus N (to correct the "subtract 1 from each digit") and there you go: the sum of the six rolled dice with only one random number generation. Oh my goodness, that is so cool! Thank you! <scampers off gleefully to code it> (05-02-2018 10:54 AM)Gamo Wrote: Our member Michaelzinn already solve this problem by using single Random with DSE Counter function. No, that program generates N random numbers and adds them up. That's not what we're looking for here. We're looking for a way to simulate getting the final total by generating only ONE random number. Jim's base 6 idea does that. <0|ΙΈ|0> -Joe- |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 9 Guest(s)