SampleBoxMuller() статический приватный Метод

Samples a pair of standard normal distributed random variables using the Box-Muller algorithm.
static private SampleBoxMuller ( Random rnd ) : double>.Tuple
rnd System.Random The random number generator to use.
Результат double>.Tuple
Пример #1
0
 /// <summary>
 /// Samples standard student-t distributed random variables.
 /// </summary>
 /// <remarks>The algorithm is method 2 in section 5, chapter 9
 /// in L. Devroye's "Non-Uniform Random Variate Generation"</remarks>
 /// <param name="rnd">The random number generator to use.</param>
 /// <param name="dof">The degrees of freedom for the standard student-t distribution.</param>
 /// <returns>a random number from the standard student-t distribution.</returns>
 private static IEnumerable <double> DoSamples(Random rnd, double dof)
 {
     while (true)
     {
         var n = Normal.SampleBoxMuller(rnd).Item1;
         var g = Gamma.Sample(rnd, 0.5 * dof, 0.5);
         yield return(Math.Sqrt(dof / g) * n);
     }
 }