Conditions | 4 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 5.2596 |
Changes | 2 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
55 | 2 | public function getRandomInt() |
|
56 | { |
||
57 | 2 | $random = openssl_random_pseudo_bytes($this->bytes, $isSourceStrong); |
|
58 | 2 | if ($random === false || ($this->forceStrong && $isSourceStrong !== true)) { |
|
59 | throw new RuntimeException( |
||
60 | 'Random number generator algorithm didn\'t used "cryptographically strong" method.' |
||
61 | ); |
||
62 | } |
||
63 | |||
64 | 2 | return hexdec(bin2hex($random)); |
|
65 | } |
||
67 |