コード例 #1
0
 /// <summary>
 /// Produces a stream of values from the random source
 /// </summary>
 /// <param name="random">The random source</param>
 /// <param name="domain">The domain of the random variable</param>
 /// <param name="filter">If specified, values that do not satisfy the predicate are excluded from the stream</param>
 /// <typeparam name="T">The element type</typeparam>
 public static IRandomStream <T> Stream <T>(this IPolyrand random, Interval <T> domain, Func <T, bool> filter = null)
     where T : struct
 => stream(random.UniformStream(domain, filter), random.RngKind);
コード例 #2
0
 /// <summary>
 /// Produces a stream of nonzero uniformly random values
 /// </summary>
 /// <param name="random">The random source</param>
 /// <param name="domain">The domain of the random variable</param>
 /// <typeparam name="T">The element type</typeparam>
 public static IRandomStream <T> NonZeroStream <T>(this IPolyrand random, Interval <T> domain)
     where T : struct
 => stream(random.UniformStream(domain, gmath.nonzero), random.RngKind);
コード例 #3
0
 /// <summary>
 /// Produces a stream values from the source subject to a specified range and optional filter
 /// </summary>
 /// <param name="random">The random source</param>
 /// <param name="domain">If specified, the domain of the random variable</param>
 /// <param name="filter">If specified, values that do not satisfy the predicate are excluded from the stream</param>
 /// <typeparam name="T">The element type</typeparam>
 public static IRandomStream <T> Stream <T>(this IPolyrand random, T min, T max, Func <T, bool> filter = null)
     where T : struct
 => stream(random.UniformStream(closed(min, max), filter), random.RngKind);