예제 #1
0
 public void NextDoubles(out double x, out double y, out double z)
 {
     for (; ;)
     {
         double d1 = 1.0 - scale * Generator.Next(),
                d2 = 1.0 - scale * Generator.Next(),
                dd = d1 * d1 + d2 * d2;
         if (dd < 1.0)
         {
             z  = 1 - 2 * dd;
             dd = 2 * Math.Sqrt(1.0 - dd);
             x  = d1 * dd;
             y  = d2 * dd;
             return;
         }
     }
 }
예제 #2
0
 /// <summary>
 /// Returns a uniformly distributed floating point random number.
 /// </summary>
 /// <returns>A uniformly distributed double-precision floating point number.</returns>
 public override double NextDouble()
 {
     return(Generator.Next(_lowerBound, _upperPlus1));
 }
예제 #3
0
 /// <summary>
 /// Returns a uniformly distributed random number.
 /// </summary>
 /// <returns>A geometric distributed 32-bit signed integer.</returns>
 public int Next()
 {
     return(Generator.Next(_lowerBound, _upperPlus1));
 }