**1**

###
#1
Members - Reputation: **1101**

Posted 04 June 2014 - 11:48 PM

I wonder what is the best way to make a lorry arrives.

I remember somebody told me that keeping a series of random numbers and

choose one of them, and see if that number is larger than a certain threshold,

then a lorry will arrive is not a good idea.

Could anyone please refresh my memory? I forgot what that post says.

Thanks

Jack

###
#2
Crossbones+ - Reputation: **24138**

Posted 04 June 2014 - 11:56 PM

He is asking when to

__a cargo truck arrive.__

**make**The procedure for deciding when to make the truck appear at a certain place.

__for__

**Not***detecting*when it arrives at a certain place.

L. Spiro

**Edited by L. Spiro, 06 June 2014 - 02:44 AM.**

My Art: http://l-spiro.deviantart.com/gallery/4844241/Realism My Music: https://soundcloud.com/l-spiro

L. Spiro Engine: http://lspiroengine.com

L. Spiro Engine Forums: http://lspiroengine.com/forums

###
#4
Crossbones+ - Reputation: **8639**

Posted 05 June 2014 - 01:50 AM

All of these are reasonable for certain design decisions. Many more are possible.

###
#7
Members - Reputation: **1101**

Posted 05 June 2014 - 04:17 AM

Hello BitMaster,

Thanks for helping.

I am not sure how to tell how frequently the function runs. I am using the Ogre3D rendering engine.

Is there a way to measure this frequency? The numbers that return will be in the range of 1-10000

so there will be 90% of the chance that the lorry will not appear?

Thanks

Jack

###
#8
Crossbones+ - Reputation: **8639**

Posted 05 June 2014 - 04:27 AM

###
#9
Crossbones+ - Reputation: **19347**

Posted 05 June 2014 - 04:44 AM

###
#10
Members - Reputation: **1101**

Posted 05 June 2014 - 05:52 AM

If I want to make this more deterministic (but still more or less random) as I need to load some data from Excel

that determines how the program would behave...

pretty stumped now. What are your suggestions to me?

Thanks

Jack

**Edited by lucky6969b, 05 June 2014 - 05:54 AM.**

###
#12
Members - Reputation: **1101**

Posted 05 June 2014 - 06:21 AM

Date Time Apple Orange Pear 10/10/2009 7:00 1 8:00 1 1

The Date and time are the "Cartons or pallets" arrival dates and times, they arrive in the trailer of the truck

I need to convert this data into the probability of truck arrival time....

Thanks

Jack

**Edited by lucky6969b, 05 June 2014 - 06:28 AM.**

###
#15
Crossbones+ - Reputation: **4089**

Posted 05 June 2014 - 07:33 AM

POPULAR

so you have a *list of trucks* that arrive *after a specified amount of minutes* plus or minus *a random amount of minutes*. And you want to *take the next truck* out of this list when the *amount of minutes has passed.*

Is this correct?

###
#18
Members - Reputation: **1933**

Posted 06 June 2014 - 03:24 AM

I.e. if you're going to add/subtract a random amount of time to when a truck arrives you'll want to determine a threshold, what is the maximum amount of time the truck could be early/late. for instance if the truck arrived at 1:00 you could set a 20 minute threshold for both arriving late or arriving early.

After that it kinda depends on the math you want to use, you could use a rand function between -20 and 20 and apply the difference(that may require a little fiddling if you're using an object representing time with a unique type) or you could pick a random 0-20 and then decide to add or subtract based on a second rand roll.

Anyway the math doesn't matter that much, the point is more that in terms of computers you're almost never going to just pick some totally random number. Most of what everyone has been trying to convey to you so far in the thread is that you have to look at your problem and decide how best to tackle it for your

**unique situation**.

**Edited by Satharis, 06 June 2014 - 03:26 AM.**

###
#19
Crossbones+ - Reputation: **5832**

Posted 06 June 2014 - 04:38 AM

If you want to model number of arrivals in a discrete time period (e.g. number of arrivals per hour, with some mean number of arrivals per time unit), you want to use the Poisson distribution:

http://en.wikipedia.org/wiki/Poisson_distribution

If you just want to model time between arrivals (with a certain mean time of arrival) you want the exponential distribution:

http://en.wikipedia.org/wiki/Exponential_distribution