/// <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()); } }
internal static int Next(this IBoundPointSource <ulong> random, int max) => max >= 0 ? (int)random.Next((ulong)max) : -(int)random.Next((ulong)(Int32.MaxValue + max));
sbyte IPointSource <sbyte> .Next() => (sbyte)(Points.Next((ulong)SByte.MaxValue * 2) - (ulong)SByte.MaxValue);