예제 #1
0
파일: BitString.cs 프로젝트: 0xCM/arrows
        /// <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));
        }
예제 #2
0
파일: BitString.cs 프로젝트: 0xCM/arrows
 public static BitString BitString <N>(this IPolyrand random, N n = default)
     where N : ITypeNat, new()
 => random.BitString((int)n.value);
예제 #3
0
파일: BitString.cs 프로젝트: 0xCM/arrows
 public static BitString BitString(this IPolyrand random, int minlen, int maxlen)
 => random.BitString(random.Next <int>(minlen, maxlen + 1));
예제 #4
0
파일: BitString.cs 프로젝트: 0xCM/arrows
 public static BitString BitString(this IPolyrand random, Interval <int> length)
 => random.BitString(length.Left, length.Right);
예제 #5
0
 public BitString Next()
 => Random.BitString(Length);