[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Interesting problem
Group-
Since the traffic seems pretty slow on this list (c'mon guys let's here
from ya!) I thought I'd post the following problem I ran into while
prototyping my game:
How do you generate random numbers with a non-linear distribution?
e.g. Suppose you are writing a football simulation in which a given team
averages 4.2 yards per rushing attempt. You want to generate random
results that will still conform to the 4.2 yard average. Something like
rand(8.4) will generate the correct average, but rules out runs of more
than 8.4 yards and runs that lose yardage. What you really want is a
random number generator that will generate numbers that average 4.2 but the
farther away you get from the mean, the less likely it is that a number
will be chosen. That is, a run of 100 yards is less likely than a run of 5
yards, but still possible.
Any thoughts?
-Brett