4 ms·
If the bus arrives on time, the arrival time would be [tau, 2 * tau, ..., N * tau]. One way to simulate "random" arrival time is to draw uniform points in the
by rhymer 2y ago
If the bus arrives on time, the arrival time would be [tau, 2 * tau, ..., N * tau].
One way to simulate "random" arrival time is to draw uniform points in the interval [0, N * tau].
It turns out the inter-arrival time generated this way is approximately exponential:
1. the difference of consecutive ordered uniformly distribution random variables follows a Beta(1, N) distribution [1].
2. As N goes to infinity, N * Beta(1, N) converges to Exponential(1) [2].
3. Since we scale the rand() by N * tau, the inter arrival time will follow an Exponential(1 / tau) distribution (as N goes to infinity), which has an expected value of tau [3].
Edit: I just realized that the author did mention this simulation is only an approximation in the side note.
[1] https://en.wikipedia.org/wiki/Order_statistic#The_joint_distribution_of_the_order_statistics_of_the_uniform_distribution https://en.wikipedia.org/wiki/Order_statistic#The_joint_dist...
[2] https://en.wikipedia.org/wiki/Beta_distribution#Special_and_limiting_cases https://en.wikipedia.org/wiki/Beta_distribution#Special_and_...
[3] https://en.wikipedia.org/wiki/Exponential_distribution#Related_distributions https://en.wikipedia.org/wiki/Exponential_distribution#Relat...