1 Attachment(s)

normal distribution random number algorithm

Hi,

I need to develop a method that basically returns a random number based on specific parameters as defined below.

The context is that this method wil go in a wider implementation of a discrete-even simulation model that reflect a specific traffic system.

Basically, the input requires to be of type double. The output must be of type double as well. I have the graph below which is to be used to development of the algorithm to return a random number.

As shown in the image, service time changes as time passes. between 06.00am and 07.10 (70 mins), mean service time is 1. Between 07.10 and 7.35 (70 mins till 95 mins), mean service time is 3 etc. I would require that the random number returned displays this characteristics, i.e. as from time NOW = 0 (mins) to time now = 70 (mins), there is a mean service time of 1 etc.

Attachment 854

I am not exactly sure how to go along and develop this. Does it make sense to develop an array with probabilities?

Any help would be appreciated.

Re: normal distribution random number algorithm

I'm not sure I understand exactly what you need, but it seems to involve a Normal distribution random number generator, in which case take a look at the nextGaussian() method of the Random class

Random (Java Platform SE 6)

Re: normal distribution random number algorithm

hi,

Would it be possible to have some assistance on the way forward to develop a random number using the von-neumann's acceptance -rejection method for the distribution in the image above? I am completley at a loss from where to start?

thanks

Re: normal distribution random number algorithm

If you can get the algorithm, someone here can probably help you write the code.

Re: normal distribution random number algorithm

One way to generate a random number for virtually any distribution is to use the cumulative distribution function of the distribution you want. You can generate uniformly distributed random numbers from y=[0,1], then solve the problem y=cdf(x) for x.

Cumulative distribution function - Wikipedia, the free encyclopedia

Re: normal distribution random number algorithm

Hi,

the algorithm for the von-neumann acceptance-rejectiom method is as follows:

1. generate a random number *u* between 0 and 180 (from the x-axis)

2. generate a random number *v* between 0 and 7 such that 0<u<7 (since it must be greater than the maximum frequency distribution).

3. if v<f(u), accept number u, else reject

4. go back to step 1.

The random number generated in step 1 must follow the probability of occurance as per the distribution in the image on the fist post, for example, the probability of mean service being 1 = 1/17, probability of mean service being 2 = 3/17 etc.

thanks