Question

I am trying to generate the Gaussian Distribution using Method 2 and Method 3 described here: http://c-faq.com/lib/gaussian.html

The problem is I am little confused as I have sigma and Mean and the 100 numbers with the range of 0 to 1 but in these methods it just returns the value for the interval of 0 to 1 and in these methods the sigma and mean value has not been used.

Can anyone help me how can I generate a Gaussian distribution using these methods?

Was it helpful?

Solution

the routines you linked to give random numbers (selected from a gaussian (normal) distribution) with mean 0 and standard deviation 1. that's the usual way routines like these work.

it's quite easy to change that to any other mean and sd - you just multiple by the sd and then add the mean.

so, for example, if x was generated by one of the routines above, then

y = 0.5 * x + 0.1

will have a standard deviation of 0.5 and a mean of 0.1.

so you don't need a separate routine for each combination of mean and sd. you just use the routines as given and then do the extra conversion.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top