24 if (isset(
$DIC[
'ilLoggerFactory'])) {
35 public function int($min =
null, $max =
null)
41 $max = mt_getrandmax();
46 return random_int($min, $max);
47 }
catch (Exception
$e) {
50 $logger->
error(
'No suitable random number generator found.');
53 }
catch (Throwable
$e) {
56 $logger->
error(
'max should be greater than min.');
62 return mt_rand($min, $max);
70 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.
logStack($a_level=null, $a_message='')
log stack trace
Wrapper for generation of random numbers, strings, bytes.
logIfPossible(callable $c)
int($min=null, $max=null)
__construct()
ilRandom constructor.