# Probability calculation

This topic is 3496 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm trying to calculate the amount of things that die from natural causes. At the moment, I've got this: For each thing, I do: if (Random number between 0 and 1) <= (Death probability) (Number to kill off) += 1 Which works fine and is exactly what I want, but I was wondering if there was a way to get the same kind of results with just a single calculation, e.g.: (Number to kill off) = (Random number) * (Death probability) * (Total number) The problem with the above is that it produces a lot lower numbers, and when there are a few things (between 1 and 100 say), you don't get any being killed off.

##### Share on other sites
The sum of discrete random variables can be approximated by a gaussian distribution with the same mean and variance. Assuming each entity has the same probability of dying P with a total number T, then the mean would be P * T and the variance would be (1 - P) * P * T. Plug those values into your favorite gaussian random number generator.

##### Share on other sites

A normal distribution is often a good approximation to the binomial distribution if you have enough events. If the probability of individual events is very small, a Poisson distribution is a better approximation.

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5
A4L
12

• 11
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633723
• Total Posts
3013541
×