I'm currently building a simulator to model transportation between an origin and a destination. If I have all the historical data since 4 years, how can I generate origin and destination using random numbers ?
Here's my solution(sorry for for my english, I speak french):
- Get the number of transport for each zone
- build a cumulative relative frequency distribution
- Generate pseudorandomly variable with (approximately) uniform distribution
- return the zone according to the variable
Ex:
[Between ; and[ :Zone
[0,00 ; 0,33[ :13
[0,33 ; 0,53[ :3
[0,53 ; 0,71[ :19
[0,71 ; 1.00[ :11
if U(0,1) = 0.432, then my originZone will be 3
Is it statistically correct ?
Thanks