Results 1 to 5 of 5
- 11-23-2011, 10:31 AM #1
Member
- Join Date
- Nov 2011
- Posts
- 2
- Rep Power
- 0
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.

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.
- 11-23-2011, 10:53 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,400
- Blog Entries
- 7
- Rep Power
- 17
Re: normal distribution random number algorithm
Have a look at the Random class, it has a nextGaussian() method that returns a N(0, 1) pseudo random number (mean == 0, standard deviation == 1); you can always adjust such a number r by transforming it to m+s*r where the mean == m and the standard deviation is s.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 11-23-2011, 11:08 AM #3
Member
- Join Date
- Nov 2011
- Posts
- 2
- Rep Power
- 0
Re: normal distribution random number algorithm
Josah,
thanks for your reply. Do you by any chance know of any resources that can help in the implementation / pseudocode?
thanks
- 11-23-2011, 11:16 AM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,400
- Blog Entries
- 7
- Rep Power
- 17
Re: normal distribution random number algorithm
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 11-23-2011, 09:55 PM #5
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,545
- Rep Power
- 11
Re: normal distribution random number algorithm
Jos has addressed the question of generating numbers randomly such that they have a specified normal distribution as you mentioned in the title of your post.
However the graph you posted does not show a normal distribution. What it shows is the mean service time taking certain discrete values at different times. It looks like you need 6 actual service time distributions, one for each of the bars. Each one would have a mean being the height of the corresponding bar.
The problem is underspecified to the extent that the graph says nothing about the desired value of the standard deviation of actual service times at any time of day.
The distributions that have the mean values shown in the graph cannot be gaussian (normal) unless you are happy with allowing for arbitrarily large actual service times and, more worryingly, negative ones.
Similar Threads
-
Algorithm for filling random polygons
By theraccoon in forum Java 2DReplies: 3Last Post: 05-18-2011, 06:35 PM -
Random Number Algorithm
By javauserjava in forum New To JavaReplies: 5Last Post: 04-06-2011, 12:32 AM -
Random number help
By jgonzalez14 in forum New To JavaReplies: 5Last Post: 09-16-2008, 09:13 AM -
Random number
By jithan in forum Advanced JavaReplies: 1Last Post: 06-13-2008, 01:42 PM -
Generate a random number
By romina in forum New To JavaReplies: 1Last Post: 08-07-2007, 05:23 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks