```--001636c5a52296416d048e045677
Content-Type: text/plain; charset=UTF-8

>
> After 10,000 trials I got an average of 803 seconds, and after a second
> 10,000 trials I got 807 seconds. But I don't think we should post any
> code until the OP has had a go.
>

Interesting. Sounds like I've got a bug to hunt down. Agreed, as far as
posting code.

> I would certainly expect wide variation between runs, since it would be
> affected very strongly by when the buses set off. However I think the
> point of the exercise is really the simulation, because it becomes very
> simple if you treat it statistically.
>
> (1) Average number of occupants per vehicle > 0.2*1+0.3*2+0.1*3+0.1*4+0.3*40  3.5
> (2) You can ignore the different travel times. The average rate at which
> vehicles depart must be the same as the average rate at which they
> arrive (law of conservation of vehicles)
> (3) The vehicles depart on average every 20 seconds
>
> So you should get an average of 0.675 passengers per second, which
> implies 500 passengers will pass any particular point after 740.7
> seconds.
>
> It then takes each passenger an average of 60 seconds to get from A to
> B, so that makes 800.7 seconds for the original question.
>
>
Nice analysis. I did a very similar set of calculations, and came up with
roughly the same result.

> I would expect the real simulation answer to be slightly different
> because of the discontinuous (bursty) nature of arrivals.
>

Can you expand on this? I'm curious what you mean, from a mathematical
perspective.

--001636c5a52296416d048e045677--

```