Conditions | 4 |
Paths | 2 |
Total Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 4.5923 |
Changes | 0 |
1 | <?php |
||
59 | 2 | public function getRandomInt() |
|
60 | { |
||
61 | 2 | $random = openssl_random_pseudo_bytes($this->bytes, $strong); |
|
62 | 2 | 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 | 2 | return hexdec(bin2hex($random)); |
|
69 | } |
||
70 | } |
||
71 |