normally distributed random number generator in c#?

Soldato
Joined
15 Feb 2011
Posts
10,234
Location
Slough
For part of my evolutionary computing assignment I need a random number generator that can generate numbers that are normally distributed, or at least close enough to normally distributed. I also need to be able to alter the σ value of this distribution at will since it will be changing a lot depending on other aspects of the program.

does anyone know of a simple way of doing this? my mind has gone completely blank

*edit*
just so it's in the post as well as the title, this is for C#
 
Last edited:
Soldato
OP
Joined
15 Feb 2011
Posts
10,234
Location
Slough
thank you, that looks perfect. I'd never even heard of it before but looking at some example code makes me think that the polar form of this will give me exactly what i'm after and should be nice and easy to use.

Could you quickly check that I'm not being stupid and that this tutorial code will give me values between 1 and -1, rather than values between 0 and 1 (and if it does give values between 0 and 1, whether those values follow the right hand side of the normal distribution type bell curve, or if they are centred around 0.5)
 
Back
Top Bottom