![]() | Bovada is the only Internet casino endorsed by the Wizard. Here are my reasons why and my promise of support. |
Random Number Generators
| March 9th, 2011 at 8:47:43 AM permalink | |
| wrragsdale Member since: Mar 7, 2011 Threads: 4 Posts: 25 | How do Random Number Generators deduce the outcomes of 2 six-sided dice rolls? |
| March 9th, 2011 at 8:53:58 AM permalink | |
| MathExtremist Member since: Aug 31, 2010 Threads: 45 Posts: 2511 | An RNG is just an algorithm for producing pseudorandom sequences of bits. Those bits can be interpreted as integers, typically in a range [0, 2^N). In order to turn such a random integer into a die, you'd just scale the output using the modulus function. There are several known methods to do this. For a six-sided cie (range 0-5) all you need is 3 bits anyway. The fair way to do this is to take 3 random bits, make sure they're not 6 or 7, and then use the value as a die roll. Do this twice and you have your roll of two dice. "In my own case, when it seemed to me after a long illness that death was close at hand, I found no little solace in playing constantly at dice."
-- Girolamo Cardano, 1563 |
| March 9th, 2011 at 9:32:28 AM permalink | |
| wrragsdale Member since: Mar 7, 2011 Threads: 4 Posts: 25 | Woah, brother, you are way above my pay grade...can you put that into layman's terms??? |
| March 9th, 2011 at 10:13:51 AM permalink | |
| DJTeddyBear Member since: Nov 2, 2009 Threads: 105 Posts: 5682 | Layman's terms? He gave you the technical answer to how a random number generator works - to pick ONE number. In there, he slipped in how to pick two dice. The simple answer is this: You have the RNG generate a number from 1 to 6 - twice. Superstitions are silly, childish, irrational rituals, born out of fear of the unknown.
But how much does it cost to knock on wood? |
| March 9th, 2011 at 10:18:18 AM permalink | |
| odiousgambit Member since: Nov 9, 2009 Threads: 172 Posts: 2394 | sometimes is just the jargon algorithm = a formula [pretty much]. It's a formula that generates a number that, for the next number, doesnt have a recognizable pattern. However, if you discover the formula, you would be able to predict the next number it seems. Let's say your algo. generate numbers 0-999. Now divide 1000 by 6 and you get 166.67. So zero to that number can be '1' on the die. If the algo. generates 167 to 333 you simulate a roll of '2', etc you can see that you can have round off errors, therefore 0-999,999 is probably better, and so on for that too. you got an answer from a non-mathemetician, let's see if that gets criticized! "Baccarat is a game whereby the croupier gathers in money with a flexible sculling oar, then rakes it home. If I could have borrowed his oar I would have stayed." Mark Twain |
| March 9th, 2011 at 11:39:46 AM permalink | |
| wrragsdale Member since: Mar 7, 2011 Threads: 4 Posts: 25 | But wouldn't it be fair to say that a RNG has no effect on dice probabilities because it's only choosing numbers at random. It has no knowledge that on six-sided dice there are more combinations to arrive at 7 than there are combinations to arrive at...let's say 2? More combinations to arrive at a 5 than at 12 etc... Is my thinking flawed? |
| March 9th, 2011 at 11:46:40 AM permalink | |
| odiousgambit Member since: Nov 9, 2009 Threads: 172 Posts: 2394 |
the dice don't know either, there is an equal chance that 1-6 comes up on one die, then on the second die that die thoughtlessly deals out 1-6 equally as well. It's just that there are 6 ways to get a 7, one way to get boxcars, etc "Baccarat is a game whereby the croupier gathers in money with a flexible sculling oar, then rakes it home. If I could have borrowed his oar I would have stayed." Mark Twain |
| March 9th, 2011 at 12:25:55 PM permalink | |
| DJTeddyBear Member since: Nov 2, 2009 Threads: 105 Posts: 5682 | Your thinking is flawed if you think the RNG picks ONE number from 2 to 12. It actually picks a number from 1 to 6. The program that is using the RNG does that twice, then adds the two random numbers to come up with the two dice total. It also compares them for Hard Ways, etc. Superstitions are silly, childish, irrational rituals, born out of fear of the unknown.
But how much does it cost to knock on wood? |
| March 9th, 2011 at 1:38:57 PM permalink | |
| s2dbaker Member since: Jun 10, 2010 Threads: 34 Posts: 1204 | The RNG that I use simply delivers a number from zero up to but not including one with precision to 15 decimal places. It's up to me, as the programmer, to make that random number do what I want. In your example of a coin flip, I would take the number issued by the RNG and multiply it by 2. I would then truncate the remaining decimals leaving me with either a zero or a one with equal probability. I would then assign the word "heads" to zero and "tails" to the numner one. In the case of the dice roll, you are talking about two seperate events with equal chances of being an integer from one to six. So it's up to me, the programmer, to grab two numbers from the RNG and assign them to two different variables from one to six. I then add up the two variables to properly simulate what happens in reality. For a deck of cards, it gets complicated so what I do is let the RNG assign a value from zero up to but not including one to each "card" in my virtual deck. I then sort the cards by the number assigned and turn those numbers into Integers from one to 52 ( or 53 with a joker ) because integers are conceptually easier to work with. In the case of a tie, the database decides the order based on the primary key so the Two of Clubs will always come before the Ace of Spades. But with granularity into the trillions, that's a risk I'm willing to accept. |
| March 9th, 2011 at 3:21:27 PM permalink | |
| kp Member since: Feb 28, 2011 Threads: 7 Posts: 422 | Is the tie breaking done before or after the conversion to integers? |
![]() | Bovada is the only Internet casino endorsed by the Wizard. Here are my reasons why and my promise of support. |
