You're quite right. When you use a single dice (twelve sided) the probability of getting any number (1 to 12 inclusive) is just 1/12. When you use two dices of 6 sides each the probability of each number is markedly different.
Value Probability Combinations
1 0
2 1/36 1:1
3 2/36 1:2, 2:1
4 3/36 1:3, 2:2, 3,1
5 4/36 1:4, 2:3, 3:2, 4:1
6 5/36 1:5, 2:4, 3:3, 4:2, 5:1
7 6/36 1:6, 2:5, 3:4, 4:3, 5:2, 6:1
8 5/36 2:6, 3:5, 4:4, 5:3, 6:2
9 4/36 3:6, 4:5, 5:4, 6:3
10 3/36 4:6, 5:5, 6:4
11 2/36 5:6, 6:5
12 1/36 6:6
Of course, if you're not using a truely random or very, very convincing pseudo-random generator you probably won't quite get these probabilities.
Considering that 7 is a bad number to get in Craps, it'd be nicer to use just a 12 sided dice, but then the Casinos would have to rig the game another way to get their money. ;)
It's good to know that for this kind of example rand() is as good as Math::Random.
jarich
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.