/// <summary> /// Performs the actual rejection sampling /// </summary> /// <returns>Random numbers with frequencies relative to the distribution of those found /// in the data file.</returns> public int GetNext() { while (true) { int index = ThreadSafeRandom.getRandomInstance().Next(0, PMF.Count); float guess = (float)ThreadSafeRandom.getRandomInstance().NextDouble() * max; if (PMF[index] > guess) { return(index + 91); } } }