[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: linuxgames@sunsite.auc.dk*Subject*: Interesting problem*From*: Brett_A._Letner@notes.up.com*Date*: Thu, 6 Aug 1998 11:06:00 -0600

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

- Prev by Date:
**Foot Ball Game** - Next by Date:
**Re: Foot Ball Game** - Prev by thread:
**Re: Interesting problem** - Next by thread:
**Re: Interesting problem** - Index(es):