Re: Dice Function

From: The Fungi (fungi@yuggoth.org)
Date: 07/07/02


On Sun, Jul 07, 2002 at 04:56:39AM -0700, Mythran wrote:
> > The probability graph of 2-12 is different for "2d12" vs merely "2-12".
>
> Take a closer look at my post.  You will see that it is not a disadvantage
> at all....
>
> 2d12 using the my dice() function has the same probability....it will not
> return just 2-12.

Let's evaluate the probabilities. For simplicity, we'll take a
simple case, 2d3, which has 5 possible values: { 2, 3, 4, 5, 6 }
There are only 5 values, but 9 possible rolls: { 1+1, 1+2, 1+3, 2+1,
2+2, 2+3, 3+1, 3+2, 3+3} This set evaluates to: { 2, 3, 4, 3, 4, 5,
4, 5, 6 } Now the probability matrix... { 2, 3, 4, 5, 6 } : { 1, 2,
3, 2, 1 } This means that out of 9 possible *equal* chances there is
a 1:9 probability or rolling either a 2 or 6, 2:9 probability of
rolling a 3 or 5 and 1:3 (or 3:9) probability of rolling a 4. Yes,
when rolling evenly weighted 2d3 you are 3 times as likely to get a
4 as you are to get a 6.

Your dice() function does not emulate this behavior because, among
other things, you aren't generating enough random numbers:

> int dice(int num, int size)
> {
>   if (num <= 0 || size <= 0)
>     return (0);
>
>   return (number(num, num * size));
> }

If we assume that the number() function has an even distribution,
then your number(2, 2 * 3) would evaluate to an even (though
discreet) gradient between 2 and 6 where there is an even
probability of each. This is analagous to 1d5+1 which has the same
range as 2d3 but *not* the same distribution. Rolling one die gets
you (with a balanced die) even chances. Consider the uses of 1d20 in
TSR games for saving throws, to-hit rolls, and the like. Rolling a
16 or better on 1d20 is a 25% chance, 17 or better is a 20% chance,
18 or better is 15%, 19 or better is 10% and 20 is 5% because you
have a 5% chance of rolling any one value, always.

Now compare to rolling 3d6 for ability scores. Similar range (3-18)
but *totally* different distribution. There are 16 possible values
but you have less than a 1% chance of rolling an 18 (or a 3) because
it only comes from one possible combination (6+6+6) out of 216
(6^3). The middle values, 9-12, are each an order of magnitude more
likely. This was chosen, as I understand, to simulate ability
distribution in the typical population where half are average
(9-12), a quarter are below (3-8) and a quarter are above (13-18).
And the higher (or lower) the ability the less "common" it is.

Rolling multiples of the same sized die results in what
statisticians call the "normal distribution" (or "bell curve") and
is used for modelling entirely different sets of characteristics
than an even distribution.
--
{ IRL(Jeremy_Stanley); PGP(9E8DFF2E4F5995F8FEADDC5829ABF7441FB84657);
SMTP(fungi@yuggoth.org); IRC(fungi@irc.yuggoth.org#ccl); ICQ(114362511);
AIM(dreadazathoth); YAHOO(crawlingchaoslabs); FINGER(fungi@yuggoth.org);
MUD(Nergel@mud.yuggoth.org:2325); WWW(http://fungi.yuggoth.org/); }

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT