double gauss() { double[] t = xrv(); double tdott = dot(t);; if (tdott >= 1) { return gauss(); } else { double val = t[0] * Math.Sqrt(-2 * (Math.Log(dot(t)) / dot(t))); return val; } } double dot(double[] t) { if (t.Length == 2) return (t[0] * t[0]) + (t[1] * t[1]); else throw new Exception("N00B"); } double[] xrv() { double[] rand = new double[2]; rand[0] = rng.NextDouble() * 2 - 1; rand[1] = rng.NextDouble() * 2 - 1; return rand; }