Conditions | 4 |
Paths | 2 |
Total Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
46 | public function getRandomInt() |
||
47 | { |
||
48 | $random = openssl_random_pseudo_bytes($this->bytes, $strong); |
||
49 | if ($random === null || ($this->forceStrong && $strong !== true)) { |
||
50 | throw new \RuntimeException( |
||
51 | 'Random number generator algorithm didn\'t used "cryptographically strong" method.' |
||
52 | ); |
||
53 | } |
||
54 | |||
55 | return hexdec(bin2hex($random)); |
||
56 | } |
||
57 | |||
58 | } |