A quick question on iDice()

All Helbreath Server Source Discussion here.
Post Reply
User avatar
Shinakuma
Member
Posts: 110
Joined: Thu Aug 04, 2005 3:52 pm
Location: USA

Post by Shinakuma »

Just want to know if:

iDice(1, 100) is:

1) 0-100

or

2) 1-100

or

3) 0-99

Just reply with one of the options above thanks! =D
Dax
<3 bd long time
Posts: 785
Joined: Mon Apr 18, 2005 3:19 pm

Post by Dax »

Shinakuma wrote: Just want to know if:

iDice(1, 100) is:

1) 0-100

or

2) 1-100

or

3) 0-99

Just reply with one of the options above thanks! =D
1~100. iDice is litteraly a dice function. The 1st parameter is the number of times you roll the die. The 2nd parameter is the number of faces on the die. If you use 4,5 as the parameters then it will return between 4~20 because it rolls a 5 faced die 4 times, each roll returns atleast 1 and a maximum of 5.

Hope you understood that. It's also how the damage formulas react on weapons. xDx+x is code for iDice(x,x)+x (Not x*x+x like most people think).
Reppin' 127.0.0.1!!!<br><br><img src='http://img502.imageshack.us/img502/1348/sig4daxbn2.jpg' border='0' alt='user posted image' /><br><br>I contend that we are both atheists. I just believe in one fewer god than you do. <br>When you understand why you dismiss all the other possible gods, you will <br>understand why I dismiss yours.<br>~ <b>Stephen Roberts</b>
User avatar
Shinakuma
Member
Posts: 110
Joined: Thu Aug 04, 2005 3:52 pm
Location: USA

Post by Shinakuma »

lol Yeah I completely understand it all actually only needed to know which one it was. I was curious as if it would roll out a 0 or not, looks like my drop list needs some changes! lol
Dax
&lt;3 bd long time
Posts: 785
Joined: Mon Apr 18, 2005 3:19 pm

Post by Dax »

Shinakuma wrote: lol Yeah I completely understand it all actually only needed to know which one it was. I was curious as if it would roll out a 0 or not, looks like my drop list needs some changes! lol
use rand%x for the type of function you are thinking of.
Reppin' 127.0.0.1!!!<br><br><img src='http://img502.imageshack.us/img502/1348/sig4daxbn2.jpg' border='0' alt='user posted image' /><br><br>I contend that we are both atheists. I just believe in one fewer god than you do. <br>When you understand why you dismiss all the other possible gods, you will <br>understand why I dismiss yours.<br>~ <b>Stephen Roberts</b>
bone-you
Spamtastic
Posts: 1310
Joined: Wed Mar 16, 2005 3:12 am

Post by bone-you »

iDice is a poor way of calculating dice damage because it averages too much. While a single rand() could produce the entire range of values, iDice will generally NEVER get the lowest or highest end of the spectrum due to the fact it is multiple rand values added together. In order to get the highest/lowest it'd have to hit that value over and over again.. wouldn't be very RANDOM would it then? Making a ton of calls to rand is good for averaging results for a more even number, but it's not accurate to the range.


Here's a sample run.

iDice(4,6)
Min: 4 Max: 24
17 8 20 13 9
16 14 8 13 15
7 11 10 11 10
18 13 10 17 13
8 8 13 12 18
10 14 8 13 20
13 19 12 11 12
16 14 14 16 18
17 19 15 13 15
14 20 15 16 15
14 17 15 8 14
10 12 9 8 9
16 10 12 5 20
16 13 10 11 14
12 12 16 12 22

nothing loewr than 8, nothing higher than 22.

Higher numbers = less relative spread.

iDice(7,9)
Min: 7 Max: 63
34 24 21 38 35 33 21 41 34 26
31 34 37 36 39 44 24 37 24 26
29 41 39 39 38 40 40 40 31 36
39 28 35 42 31 31 38 37 36 38
35 32 37 33 31 41 40 29 24 47
27 34 38 35 37 33 39 42 50 40
43 21 43 29 43 50 33 21 37 32
38 38 34 33 42 29 21 38 45 44
43 29 40 22 33 24 40 36 33 42
26 25 40 38 36 38 41 38 34 37
21 25 34 43 27 23 42 22 41 24
29 23 32 28 39 34 35 32 44 40
40 26 31 43 37 32 24 42 19 26
37 35 37 28 29 38 28 39 25 20
39 36 18 35 42 37 40 41 39 35
<img src='http://www.helbreathx.net/sig/sig.jpeg' border='0' alt='user posted image' /><br><a href='http://mafia.cheats4us.org/index.php?x=231030' target='_blank'>#1 on Mafia :D</a><br><!--QuoteBegin-Slipknight+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Slipknight)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->100mb Internet, burstable too 10GB oc192<br>his speed can go up too 10gbs<br>...<br>Yes my car can have a top speed of 1000mph<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>^^ I wonder where the retard went to.
Dax
&lt;3 bd long time
Posts: 785
Joined: Mon Apr 18, 2005 3:19 pm

Post by Dax »

bone-you wrote: iDice is a poor way of calculating dice damage because it averages too much. While a single rand() could produce the entire range of values, iDice will generally NEVER get the lowest or highest end of the spectrum due to the fact it is multiple rand values added together. In order to get the highest/lowest it'd have to hit that value over and over again.. wouldn't be very RANDOM would it then? Making a ton of calls to rand is good for averaging results for a more even number, but it's not accurate to the range.


Here's a sample run.

iDice(4,6)
Min: 4 Max: 24
17 8 20 13 9
16 14 8 13 15
7 11 10 11 10
18 13 10 17 13
8 8 13 12 18
10 14 8 13 20
13 19 12 11 12
16 14 14 16 18
17 19 15 13 15
14 20 15 16 15
14 17 15 8 14
10 12 9 8 9
16 10 12 5 20
16 13 10 11 14
12 12 16 12 22

nothing loewr than 8, nothing higher than 22.

Higher numbers = less relative spread.

iDice(7,9)
Min: 7 Max: 63
34 24 21 38 35 33 21 41 34 26
31 34 37 36 39 44 24 37 24 26
29 41 39 39 38 40 40 40 31 36
39 28 35 42 31 31 38 37 36 38
35 32 37 33 31 41 40 29 24 47
27 34 38 35 37 33 39 42 50 40
43 21 43 29 43 50 33 21 37 32
38 38 34 33 42 29 21 38 45 44
43 29 40 22 33 24 40 36 33 42
26 25 40 38 36 38 41 38 34 37
21 25 34 43 27 23 42 22 41 24
29 23 32 28 39 34 35 32 44 40
40 26 31 43 37 32 24 42 19 26
37 35 37 28 29 38 28 39 25 20
39 36 18 35 42 37 40 41 39 35
That's a good point. Thanks for pointing that out, i'll be sure to do somthing about it one day.
Reppin' 127.0.0.1!!!<br><br><img src='http://img502.imageshack.us/img502/1348/sig4daxbn2.jpg' border='0' alt='user posted image' /><br><br>I contend that we are both atheists. I just believe in one fewer god than you do. <br>When you understand why you dismiss all the other possible gods, you will <br>understand why I dismiss yours.<br>~ <b>Stephen Roberts</b>
bone-you
Spamtastic
Posts: 1310
Joined: Wed Mar 16, 2005 3:12 am

Post by bone-you »

Damage = minvalue + (rand()%(maxvalue-minvalue)) + extradamage + 1
<img src='http://www.helbreathx.net/sig/sig.jpeg' border='0' alt='user posted image' /><br><a href='http://mafia.cheats4us.org/index.php?x=231030' target='_blank'>#1 on Mafia :D</a><br><!--QuoteBegin-Slipknight+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Slipknight)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->100mb Internet, burstable too 10GB oc192<br>his speed can go up too 10gbs<br>...<br>Yes my car can have a top speed of 1000mph<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>^^ I wonder where the retard went to.
Dax
&lt;3 bd long time
Posts: 785
Joined: Mon Apr 18, 2005 3:19 pm

Post by Dax »

bone-you wrote: Damage = minvalue + (rand()%(maxvalue-minvalue)) + extradamage + 1
Not bad ;)

I was actually thinking of some form of probability each dice roll based on current skill %. But mine would just raise the probability of higher hitting, yours fixes the averaging.
Reppin' 127.0.0.1!!!<br><br><img src='http://img502.imageshack.us/img502/1348/sig4daxbn2.jpg' border='0' alt='user posted image' /><br><br>I contend that we are both atheists. I just believe in one fewer god than you do. <br>When you understand why you dismiss all the other possible gods, you will <br>understand why I dismiss yours.<br>~ <b>Stephen Roberts</b>
Post Reply