@@ -19,7 +19,7 @@ public MersenneTwister(int seed)
1919 /// Creates a new pseudo-random number generator with a default seed.
2020 /// </summary>
2121 /// <remarks>
22- /// <c>new <see cref="System.Random"/>().<see cref="Random.Next()"/></c>
22+ /// <c>new <see cref="System.Random"/>().<see cref="Random.Next()"/></c>
2323 /// is used for the seed.
2424 /// </remarks>
2525 public MersenneTwister ( ) : this ( new Random ( ) . Next ( int . MinValue , int . MaxValue ) ) /* a default initial seed is used */
@@ -34,7 +34,7 @@ public MersenneTwister(int[] initKey)
3434 {
3535 if ( initKey == null )
3636 {
37- throw new ArgumentNullException ( " initKey" ) ;
37+ throw new ArgumentNullException ( nameof ( initKey ) ) ;
3838 }
3939
4040 uint [ ] initArray = new uint [ initKey . Length ] ;
@@ -82,13 +82,13 @@ public override int Next(int maxValue)
8282 }
8383
8484 /// <summary>
85- /// Returns the next pseudo-random <see cref="Int32"/>
86- /// at least <paramref name="minValue"/>
85+ /// Returns the next pseudo-random <see cref="Int32"/>
86+ /// at least <paramref name="minValue"/>
8787 /// and up to <paramref name="maxValue"/>.
8888 /// </summary>
8989 /// <param name="minValue">The minimum value of the pseudo-random number to create.</param>
9090 /// <param name="maxValue">The maximum value of the pseudo-random number to create.</param>
91- /// <returns>A pseudo-random Int32 value which is at least <paramref name="minValue"/> and at
91+ /// <returns>A pseudo-random Int32 value which is at least <paramref name="minValue"/> and at
9292 /// most <paramref name="maxValue"/>.</returns>
9393 /// <exception cref="ArgumentOutOfRangeException">
9494 /// If <c><paramref name="minValue"/> >= <paramref name="maxValue"/></c>.
@@ -137,17 +137,17 @@ public override void NextBytes(byte[] buffer)
137137 /// <returns>A pseudo-random double floating point value.</returns>
138138 /// <remarks>
139139 /// <para>
140- /// There are two common ways to create a double floating point using MT19937:
141- /// using <see cref="GenerateUInt32"/> and dividing by 0xFFFFFFFF + 1,
142- /// or else generating two double words and shifting the first by 26 bits and
140+ /// There are two common ways to create a double floating point using MT19937:
141+ /// using <see cref="GenerateUInt32"/> and dividing by 0xFFFFFFFF + 1,
142+ /// or else generating two double words and shifting the first by 26 bits and
143143 /// adding the second.
144144 /// </para>
145145 /// <para>
146- /// In a newer measurement of the randomness of MT19937 published in the
146+ /// In a newer measurement of the randomness of MT19937 published in the
147147 /// journal "Monte Carlo Methods and Applications, Vol. 12, No. 5-6, pp. 385 ñ 393 (2006)"
148148 /// entitled "A Repetition Test for Pseudo-Random Number Generators",
149- /// it was found that the 32-bit version of generating a double fails at the 95%
150- /// confidence level when measuring for expected repetitions of a particular
149+ /// it was found that the 32-bit version of generating a double fails at the 95%
150+ /// confidence level when measuring for expected repetitions of a particular
151151 /// number in a sequence of numbers generated by the algorithm.
152152 /// </para>
153153 /// <para>
@@ -250,24 +250,23 @@ private void init(uint seed)
250250 for ( this . _mti = 1 ; this . _mti < MersenneTwister . N ; this . _mti ++ )
251251 {
252252 this . _mt [ this . _mti ] = ( uint ) ( 1812433253u * ( this . _mt [ this . _mti - 1 ] ^ ( this . _mt [ this . _mti - 1 ] >> 30 ) ) + this . _mti ) ;
253- // See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier.
254- // In the previous versions, MSBs of the seed affect
255- // only MSBs of the array _mt[].
256- // 2002/01/09 modified by Makoto Matsumoto
253+ // See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier.
254+ // In the previous versions, MSBs of the seed affect
255+ // only MSBs of the array _mt[].
256+ // 2002/01/09 modified by Makoto Matsumoto
257257 this . _mt [ this . _mti ] &= 0xffffffffu ;
258258 // for >32 bit machines
259259 }
260260 }
261261
262262 private void init ( uint [ ] key )
263263 {
264- int i , j , k ;
265264 this . init ( 19650218u ) ;
266265
267266 int keyLength = key . Length ;
268- i = 1 ;
269- j = 0 ;
270- k = ( MersenneTwister . N > keyLength ? MersenneTwister . N : keyLength ) ;
267+ int i = 1 ;
268+ int j = 0 ;
269+ int k = ( MersenneTwister . N > keyLength ? MersenneTwister . N : keyLength ) ;
271270
272271 for ( ; k > 0 ; k -- )
273272 {
@@ -326,7 +325,7 @@ private double compute53BitRandom(double translate, double scale)
326325 // add another pseudo-random 26 bits (+ b).
327326 return ( ( a * 67108864.0 + b ) + translate ) * scale ;
328327
329- // What about the following instead of the above? Is the multiply better?
328+ // What about the following instead of the above? Is the multiply better?
330329 // Why? (Is it the FMUL instruction? Does this count in .Net? Will the JITter notice?)
331330 //return BitConverter.Int64BitsToDouble((a << 26) + b));
332331 }
0 commit comments