# Intentional bias in random numbers

8 replies to this topic

### #1 senior_falconOFFLINE

senior_falcon

Stargunner

• 1,229 posts
• Location:Lansing, NY, USA

Posted Tue Oct 10, 2017 9:13 PM

While looking at an old program listing (Chateau Gaillard by Tim Hartnell) I came upon this:

X=RND*6+RND*6+RND*6

This struck me as odd: why not just use X=RND*18?

It turns out that the first example heavily biases the random number toward the middle of the range.  There are many more ways to get numbers around the middle than there are ways to get numbers at the low and high extremes.  If it is INT(RND*6)+INT(RND*6)+INT(RND*6) there is only 1 way to get a 0 or 15; 3 ways to get a 1 or 14; 6 ways to get a 2 or 13; 10 ways to get a 3 or 12, and so on.

### #2 PeteEOFFLINE

PeteE

Chopper Commander

• 155 posts
• Location:Beaverton, OR

Posted Tue Oct 10, 2017 10:38 PM

If you are rolling dice, it would be 3d6 - 3.  That notation is common in tabletop role playing games.

### #3 phoenixdownitaOFFLINE

phoenixdownita

River Patroller

• 3,249 posts

Posted Tue Oct 10, 2017 11:17 PM

It's not BIAS, it's simply a different distribution.

Putting aside for a moment if RANDOM itself is totally RANDOM or only PSEUDORANDOM, the 18*RANDOM literally only shows a uniform distribution, while the 6*RANDOM+6*RANDOM+6*RANDOM gives you a bell curve

It has nothing to do with BIAS it's simulating different phenomena, the first is a roll of a fair 18-sided dice (if there was such a thing) the second is the sum of 3 rolls of a fair 6 sided dice (or the sum of a roll of 3 fair 6 sided dice at once if you prefer), different distributions.

For more dice it gets flatter relatively speaking.

### #4 carlssonONLINE

carlsson

Metagalactic Mule

• 7,511 posts
• Location:Västerås, Sweden

Posted Wed Oct 11, 2017 2:54 AM

I saw that Chateau Gallard is an adventure/RPG so most probably Tim Hartnell indeed is simulating dice throws, instead of aiming at a range of random numbers 1-18.

### #5 VorticonOFFLINE

Vorticon

River Patroller

• 3,245 posts
• Location:Eagan, MN, USA

Posted Wed Oct 11, 2017 6:54 AM

Never thought of it that way although it makes perfect sense from a probabilities standpoint. Definitely will have to incorporate that into future programs.

### #6 SinphaltimusOFFLINE

Sinphaltimus

River Patroller

• 2,514 posts
• Distracted at the Keyboard
• Location:Poconos, PA

Posted Wed Oct 11, 2017 9:12 AM

<SNIP>.... is a roll of a fair 18-sided dice (if there was such a thing) ,......<SNIP>

https://www.amazon.c...e/dp/B00OBQ6CII

Stargunner

• 1,349 posts

Posted Wed Oct 11, 2017 9:50 AM

The distribution issue is a big part of why the twenty-sided die was used in Dungeons & Dragons. The early game designers knew six-siders could never give them a greater range because adding more dice simply creates the bell curve of values, skewing results towards the middle values. (One game system that uses this to good effect is GURPS, where skills and checks are done on 3d6, and the average skill is 10.)

I read a story awhile back that they got twenty-siders because Dave Arneson had been to Great Britain with his parents and he had picked up several mini d20's at a hobby shop there as a curiosity. The big issue that TSR had in the early days was finding a supplier who could get them dice; they eventually found it in a toy company that made plastic dice in different shapes for kids. Which is where the other poly-sided dice came from, they figured, why not use all of them?

### #8 TursiOFFLINE

Tursi

• 5,231 posts
• HarmlessLion
• Location:BUR

Posted Wed Oct 11, 2017 2:54 PM

I've sort of wondered about this before, it's neat to see it broken down and is certainly knowledge I'll use in the future as well!

### #9 zzipOFFLINE

zzip

River Patroller

• 2,534 posts

Posted Wed Oct 11, 2017 3:04 PM

While looking at an old program listing (Chateau Gaillard by Tim Hartnell) I came upon this:
X=RND*6+RND*6+RND*6
This struck me as odd: why not just use X=RND*18?
It turns out that the first example heavily biases the random number toward the middle of the range.  There are many more ways to get numbers around the middle than there are ways to get numbers at the low and high extremes.  If it is INT(RND*6)+INT(RND*6)+INT(RND*6) there is only 1 way to get a 0 or 15; 3 ways to get a 1 or 14; 6 ways to get a 2 or 13; 10 ways to get a 3 or 12, and so on.

As others point out, D&D had many exotic dice that could have rolled linear random numbers, but when it came to character attributes, the idea was you didn't want many characters to be too exceptional or too weak. so you'd role a 6 sided die 3x to determine states along a bell curve. So rolling a 6 sided die 3x was the standard way to determine your characters Strength, Intelligence, Dexterity, etc.

#### 0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users