Conditions | 4 |
Paths | 2 |
Total Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
59 | public function getRandomInt() |
||
60 | { |
||
61 | $random = openssl_random_pseudo_bytes($this->bytes, $strong); |
||
62 | if ($random === false || ($this->forceStrong && $strong !== true)) { |
||
63 | throw new RuntimeException( |
||
64 | 'Random number generator algorithm didn\'t used "cryptographically strong" method.' |
||
65 | ); |
||
66 | } |
||
67 | |||
68 | return hexdec(bin2hex($random)); |
||
69 | } |
||
70 | } |
||
71 |