28 if (isset(
$DIC[
'ilLoggerFactory'])) {
29 $c(
$DIC->logger()->rnd());
39 public function int($min =
null, $max =
null)
45 $max = mt_getrandmax();
50 return random_int($min, $max);
51 }
catch (Exception $e) {
54 $logger->error(
'No suitable random number generator found.');
57 }
catch (Throwable $e) {
60 $logger->error(
'max should be greater than min.');
66 return mt_rand($min, $max);
74 if(version_compare(PHP_VERSION ,
'7.0.0',
'>=')) {
An exception for terminatinating execution or to throw for unit testing.
Component logger with individual log levels by component id.
Wrapper for generation of random numbers, strings, bytes.
logIfPossible(callable $c)
int($min=null, $max=null)
__construct()
ilRandom constructor.