NextInt() public method

Generates a random int over the range 0 to int.MaxValue, inclusive. This method differs from Next() only in that the range is 0 to int.MaxValue and not 0 to int.MaxValue-1. The slight difference in range means this method is slightly faster than Next() but is not functionally equivalent to System.Random.Next().
public NextInt ( ) : int
return int
コード例 #1
0
        public void NextInt()
        {
            int sampleCount = 10000000;
            XorShiftRandom rng = new XorShiftRandom();
            double[] sampleArr = new double[sampleCount];

            for(int i=0; i<sampleCount; i++){
                sampleArr[i] = rng.NextInt();
            }

            UniformDistributionTest(sampleArr, 0.0, int.MaxValue + 1.0);
        }
コード例 #2
0
 /// <summary>
 /// Initialises a new instance using a seed generated from the class's static seed RNG.
 /// </summary>
 public XorShiftRandom()
 {
     Reinitialise(__seedRng.NextInt());
 }