# Simulating a probability, use a random number?

1. Mar 4, 2013

Hello,

I looking for some advice for a simulation. I know that when an electric car arrives at a destination there is a 70% chance that a charging point will be available. I'm building a model that models electric car journeys. When a car arrives at a destination would I simulate a random number between 0 and 1 and if it is less than 0.7 then a charging post is available or if it is greater than 0.7 then a charging post is not available. Would that make sense? I would appreciate any suggestions or comments.

Thank you

2. Mar 4, 2013

### mathman

Your description is exactly correct for the simulation.

3. Mar 8, 2013

Hello MAthman,

Could you perhaps explain the statistical logic/theory for simulating an event like this?

In an other example, I know the probability that somebody will recharge an electric car is 60%. So if I generate a random number and it is less than 0.6 then the person plugs in and consumes electricity. I'm interested to know the statistical logic behind the method.

J

4. Mar 8, 2013

### MrAnchovy

60% of the time somebody charges an electric car.

60% of the time a (pseudo)-random number between 0 and 1 is less than 0.6.

So the latter is a good simulation of the former.