To get a random number from a normal distribution with a mean of 0 and a standard deviation of 1 in C#, you can use the Random
class from the System
namespace and the Box-Muller transform.
Here's the code:
main.cs249 chars6 lines
This code generates two random numbers from a uniform distribution and uses them to generate a random number from a normal distribution using the Box-Muller transform. The resulting number will have a mean of 0 and a standard deviation of 1.
gistlibby LogSnag