23 if (isset(
$DIC[
'ilLoggerFactory'])) {
34 public function int($min =
null, $max =
null)
40 $max = mt_getrandmax();
45 return random_int($min, $max);
46 }
catch (Exception $e) {
49 $logger->
error(
'No suitable random number generator found.');
52 }
catch (Throwable $e) {
55 $logger->
error(
'max should be greater than min.');
61 return mt_rand($min, $max);
69 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.