Graham.Johnson
New Member
- Joined
- Jun 29, 2010
- Messages
- 3
Hi,
I need to randomly generate a set of 5000 numbers using just the following three inputs:
>Min
>Mean
>Max
They have to be normally distributed, but as the mean is never exactly half way between the min and max, the distribution will be skewed.
I am using =(NORMSINV(RAND())*0.13)+0.5 to give me 5000 random numbers that are normally distributed with a mean of 0.5 and (almost always) have a min of 0 and a max of 1.
I am then mapping these to the distribution that I require using
If random number < 0.5, f(x)=min+2*rand*(mean-min)
If random number = 0.5, f(x)=mean
If random number > 0.5, f(x)=mean+2*(rand-0.5)*(max-mean)
As expected this is giving me numbers within the predefined bounds, however the mean is way off what I was expecting.
For example, a min of 50,000, mean of 225,000 and a max of 1,000,000 give the following output:
>Min ~ 50,000-60,000 (this is close enough)
>Mean ~ 288,000-290,000 (this is no where near)
>Max ~ 950,000-1,000,000 (this is close enough)
I am not sure if there is a problem with my mapping formula, if it is to do with how I am generating the random numbers in the first place, or something else, but I am now stuck.
If anyone has any experience of this, or can offer any advice, then I would be most grateful!
Many thanks in advance,
Graham
I need to randomly generate a set of 5000 numbers using just the following three inputs:
>Min
>Mean
>Max
They have to be normally distributed, but as the mean is never exactly half way between the min and max, the distribution will be skewed.
I am using =(NORMSINV(RAND())*0.13)+0.5 to give me 5000 random numbers that are normally distributed with a mean of 0.5 and (almost always) have a min of 0 and a max of 1.
I am then mapping these to the distribution that I require using
If random number < 0.5, f(x)=min+2*rand*(mean-min)
If random number = 0.5, f(x)=mean
If random number > 0.5, f(x)=mean+2*(rand-0.5)*(max-mean)
As expected this is giving me numbers within the predefined bounds, however the mean is way off what I was expecting.
For example, a min of 50,000, mean of 225,000 and a max of 1,000,000 give the following output:
>Min ~ 50,000-60,000 (this is close enough)
>Mean ~ 288,000-290,000 (this is no where near)
>Max ~ 950,000-1,000,000 (this is close enough)
I am not sure if there is a problem with my mapping formula, if it is to do with how I am generating the random numbers in the first place, or something else, but I am now stuck.
If anyone has any experience of this, or can offer any advice, then I would be most grateful!
Many thanks in advance,
Graham