Example #1
0
 /**
  * Generates a random integer number between $min and $max (inclusive).
  *
  * @param int $min will be set to 0 if not given
  * @param int $max will be set to getMaxRandomNumber() if not given
  * @return int
  */
 public function getRandomNumber($min = -1, $max = -1)
 {
     if ($this->nextRandomNumber >= 0 && $this->nextRandomNumber >= ($min == -1 ? 0 : $min) && $this->nextRandomNumber <= ($max == -1 ? $this->getMaxRandomNumber() : $max)) {
         $rand = $this->nextRandomNumber;
         $this->nextRandomNumber = -1;
         return $rand;
     }
     return $this->realRandom->getRandomNumber($min, $max);
 }