Simple random number generator with Gaussian probability distribution

Was wondering if anyone knows of an easy way to have a random number generator that has a gaussian probability distribution.

Currently I am using rand(), but this gives me a uniform probability distribution. Is there a simple rand_gaussian() function somewhere that would enable me to do this?
I know for example in matlab you can use rand() for uniform distribution and randn() for gaussian or normal distribution.

for (int i = 0; i < nowalkers; i++){
walkerpos[i] = 8 * (rand() / (double)RAND_MAX) - 3;
PosI << walkerpos[i] << std::endl;
}
Thanks!
Topic archived. No new replies allowed.