the random number generator

Moderator: Event DM

Post Reply
User avatar
Malathyre
Sage
Posts: 2079
Joined: Wed Sep 24, 2003 8:47 pm
Location: Michigan, U.S.A. (GMT-5)
Contact:

the random number generator

Post by Malathyre » Mon Feb 14, 2005 8:56 pm

Out of curiousity, does anyone know how this thing really works? I'm not interested in the d20 rolls anymore, I figure the RNG does a good enough job of randomly generating a number between one and twenty. I am curious how it does the dice rolling for other dice, however. Specifically, let's say you have an ability that rolls 4d10 damage. My suspicion is that the random number generator assigns equal probability to all numbers between 4 and 40 for this dice set...even though all numbers rollable by 4d10 most certainly do NOT have equal probability of being rolled.

Translation: I've seen my character's wyrmling form roll 40 for damage on her 4d10 breath weapon. More than once. I've also seen her roll 4 more than once...I highly suspect it is because all numbers between 4 and 40 were assigned equal probably by the RNG, but I have no idea where to look or how to figure this out.

It's not important at all and I don't care if is just generating a number between 4 and 40 and not really taking into account the type of "dice". I was just curious if anyone knew how this thing worked for sure. Thanks!
"The stars predict tomorrow you'll wake up, do a bunch of stuff, and then go back to sleep!"--Your Horoscope for Today, Weird Al Yankovic
dougnoel
Team Member; Retired with Honors
Posts: 6261
Joined: Fri May 14, 2004 4:59 pm
Location: VA (GMT -4)
Contact:

Post by dougnoel » Tue Feb 15, 2005 5:22 am

It's rolling 4d10, it's using the d10() function. wE can only guess at the implementation. However, my guess is that Bioware skews the output to make things seem more heroic. Basically it grades on a curve...
User avatar
Malathyre
Sage
Posts: 2079
Joined: Wed Sep 24, 2003 8:47 pm
Location: Michigan, U.S.A. (GMT-5)
Contact:

Post by Malathyre » Tue Feb 15, 2005 6:08 am

Thanks, dougnoel. I'm no statistician, but the odds of rolling all 10's on 4d10 are not good...and I've seen it happen more than once in game. Sometimes, it is more fun if those random numbers are a bit less random. ;)
"The stars predict tomorrow you'll wake up, do a bunch of stuff, and then go back to sleep!"--Your Horoscope for Today, Weird Al Yankovic
User avatar
ReallyStupidGuy
Scholar of Fools
Posts: 435
Joined: Sun Sep 26, 2004 1:44 am
Location: VA
Contact:

Post by ReallyStupidGuy » Tue Feb 15, 2005 6:20 am

aaahhh... dice are just so wonderful, especially the cyber kind that can roll whatever they want like multiple successive 1's to hit when all you need is a 2 to hit!
Bashthraka
Durub of the Zu'tah Shak Brotherhood
Advocate of the holy order of Valok
Soldier in the alpha corps
Journeyman of the 4A
User avatar
tindertwiggy
Legacy DM
Legacy DM
Posts: 6905
Joined: Tue Jul 16, 2002 12:20 am
Location: Newish England
Contact:

Post by tindertwiggy » Tue Feb 15, 2005 6:43 am

successive 1's IS random!
Happiness is baked with one part bat guano, one part sulfur.
User avatar
Dirk Cutlass
Elder Sage
Posts: 4691
Joined: Mon Jan 27, 2003 9:42 am
Location: GMT

Post by Dirk Cutlass » Tue Feb 15, 2005 9:59 am

dougnoel wrote:It's rolling 4d10, it's using the d10() function. wE can only guess at the implementation. However, my guess is that Bioware skews the output to make things seem more heroic. Basically it grades on a curve...
I thought Spellsinger or someone did some work on this before ... maybe I'll dig it out.

Personally, I don't think they deliberately skewed the output on some curve. I just think they implemented it badly...

Linear Congruential Generators, which are the norm for pseudo-random number generators on computers are notoriously un-random in their lower order bits. My bet is that when they "scale" the number to make it a d10 or d20 or whatever, they used modulo function "%" rather than doing a proper scaling. The former is more common practise for a "C" programmer, e.g. when you want to limit the range of a variable x you do "x = x % N" or something.

But the modulous means that lower-order bits are used.. which as I mentioned before are not very random, so lots of 1,1 and 20, 20 and other such combos occuring more than they should do.

The effect of this may be to make it seem "more heroic", but I think that's just the way it seems. I doubt that Bioware really thought of it, and its just like it is because of their lack of understanding of pseudo-randomness.

Of course this is just speculation :D

(If any Bioware s/w programmer is reading this... feel free to put us all straight!)

EDIT:
Malathyre wrote:I'm no statistician, but the odds of rolling all 10's on 4d10 are not good...
Actually the odds are 1 / (10 x 10 x 10 x 10) = 1 / 10000
Post Reply