100) { throw new InvalidArgumentException('The value for the probability '. ' must be in a range from 0 to 100.'); } else if (!is_int($prob)) { throw new InvalidArgumentException('rand_bool only accepts integers.'); } $rand = rand(1, 100); return $rand <= $prob; }