示例#1
0
 public SamplingLongPrimitiveIterator(RandomWrapper random, IEnumerator <long> enumerator, double samplingRate)
 {
     if (enumerator == null)
     {
         throw new ArgumentException("enumerator");
     }
     if ((samplingRate <= 0.0) || (samplingRate > 1.0))
     {
         throw new ArgumentException("samplingRate");
     }
     this.geometricDistribution = new PascalDistribution(random.getRandomGenerator(), 1, samplingRate);
     this.enumerator            = enumerator;
     this.SkipNext();
 }
示例#2
0
        public SamplinglongPrimitiveIterator(RandomWrapper random, IEnumerator <long> enumerator, double samplingRate)
        {
            if (enumerator == null)
            {
                throw new ArgumentException("enumerator");
            }
            if (!(samplingRate > 0.0 && samplingRate <= 1.0))
            {
                throw new ArgumentException("samplingRate");
            }
            //Preconditions.checkArgument(samplingRate > 0.0 && samplingRate <= 1.0, "Must be: 0.0 < samplingRate <= 1.0");
            // Geometric distribution is special case of negative binomial (aka Pascal) with r=1:
            geometricDistribution = new PascalDistribution(random.getRandomGenerator(), 1, samplingRate);
            this.enumerator       = enumerator;

            SkipNext();
        }