Esempio n. 1
0
 /**
  * Generates a random number and returns a boolean representing whether it is within a given percentile.
  * For example: inPercentile(0.1) is equivalent to rand(1, 1000) == 1.
  *
  * @param float $perc The percentile to evaluate, can also be < 1.
  * @return boolean
  */
 public function inPercentile($perc)
 {
     if ($this->nextRandomNumber >= 0 && $this->nextRandomNumber <= 100 && $perc >= 0 && $perc <= 100) {
         $rand = $this->nextRandomNumber;
         $this->nextRandomNumber = -1;
         return $rand <= $perc;
     }
     return $this->realRandom->inPercentile($perc);
 }