Esempio n. 1
0
 /// <summary>
 /// Produces a random stream predicated on a point source
 /// </summary>
 /// <param name="random">The point source</param>
 /// <typeparam name="T">The point type</typeparam>
 public static IEnumerable <T> Stream <T>(this IBoundPointSource <T> random)
     where T : struct
 {
     while (true)
     {
         yield return(random.Next());
     }
 }
Esempio n. 2
0
 internal static int Next(this IBoundPointSource <ulong> random, int max)
 => max >= 0 ? (int)random.Next((ulong)max)
         : -(int)random.Next((ulong)(Int32.MaxValue + max));
Esempio n. 3
0
 sbyte IPointSource <sbyte> .Next()
 => (sbyte)(Points.Next((ulong)SByte.MaxValue * 2) - (ulong)SByte.MaxValue);