using MathNet.Numerics.Distributions;
public static void Main()
double stddev = Math.Sqrt(n * p * (1 - p));
var normalDist = new Normal(mean, stddev);
double sample = normalDist.Sample();
int roundedSample = (int)Math.Round(sample);
roundedSample = Math.Max(0, Math.Min(n, roundedSample));
Console.WriteLine("Random sample from Normal approximation (rounded and bounded): {0}", roundedSample);