/// <summary> /// Produces sequences of random bitstrings with specified length /// </summary> /// <param name="random">The random source</param> /// <param name="len">The length of the produced bitstrings</param> public static IRandomStream <BitString> BitStrings(this IPolyrand random, int len) { IEnumerable <BitString> produce() { while (true) { yield return(random.BitString(len)); } } return(stream(produce(), random.RngKind)); }
public static BitString BitString <N>(this IPolyrand random, N n = default) where N : ITypeNat, new() => random.BitString((int)n.value);
public static BitString BitString(this IPolyrand random, int minlen, int maxlen) => random.BitString(random.Next <int>(minlen, maxlen + 1));
public static BitString BitString(this IPolyrand random, Interval <int> length) => random.BitString(length.Left, length.Right);
public BitString Next() => Random.BitString(Length);