Poportional random numbers

Started by
10 comments, last by TechnoGoth 19 years, 11 months ago
Rewriting
quote:Original post by TechnoGoth
Goal:

To generate a set, X, of random numbers where the distribution of values in X, from min to max, is nonuniform, and where the number of values in X at distance D from the mean decreases in proportion to D's absolute value.


There. That's better. And you're just talking about adding a weight to a normal randomization. In this case, your weight factor is 1/D.

ld

Edit: weight factor is NOT D, it is D's reciprocal.

[edited by - liquiddark on May 13, 2004 1:09:58 PM]
No Excuses
Advertisement
The info does help somewhat. The thing is there a lot of randomizer systems. Just take a quick tour of tabletop games if you want some samples.

Let's look back at the original formula. While it would work, it could be optimized a bit. It looks like your saying: Stat_value = base_value + random_value; where random_value is a randomly generated number betweem -50 and 50, with number around +0 being increasing frequent.

If that's what you're looking for, then there are faster methods than using "( sign * ( range_value + modifer_value ) )" for random_value. After all, it does involve multiplication and looking up the range value.

Take a look at these probability curves, curtesy of Kiki's Dice Probability Generator. (Note, this is scaled down and rounded version of the tables produced by the generator.)
Result r1 r2 r3 r4
-50 1 1 0 1
-40 1 11 55 286
-30 1 21 210 1771
-20 1 31 465 5316
-10 1 41 757 9621
0 1 51 867 11726
10 1 41 777 9621
20 1 31 496 5316
30 1 21 231 1171
40 1 11 66 286
50 1 1 1 1
r1 = d100 - 50, r2 = 2d51 - 52, r3 = 3d34 - 52, r4 = 4d26 - 54

Looking at your example, I'd say you're looking a 2-value sum. Try letting random_value = random(0 to 50) - random(0 to 50). This will give you the kind of distribution seen under r2. It produces the same range as your original formula, and shifts the events towards the center(+0), without making the pull too extreme.

Here's the generalized verion for what I'm talking about:
stat = base + random(0 to x) - random(0 to x)
minimum = base - x
maximum = base + x
mean = base

Note: this is basically the "Variance Sum" method I described earlier.

[edited by - Shimeran on May 14, 2004 3:47:37 AM]

This topic is closed to new replies.

Advertisement