Exemple #1
0
        private static ulong[] MakeState(ISeedSequence seedSequence)
        {
            if (seedSequence is null)
            {
                throw new ArgumentNullException(nameof(seedSequence));
            }

            var state = new ulong[N];

            seedSequence.Generate(state);
            return(state);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MersenneTwister32Bit19937"/> class.
        /// </summary>
        /// <param name="seedSequence">
        /// The seed source.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="seedSequence"/> is null.
        /// </exception>
        public MersenneTwister32Bit19937(ISeedSequence seedSequence)
        {
            if (seedSequence is null)
            {
                throw new ArgumentNullException(nameof(seedSequence));
            }

            var temp = new uint[N];

            seedSequence.Generate(temp);
            this.state = temp;
            this.index = N;
        }