File tree Expand file tree Collapse file tree 1 file changed +26
-4
lines changed Expand file tree Collapse file tree 1 file changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -1398,10 +1398,32 @@ public static function random($min, $max) {
1398
1398
static $ rnd_value ;
1399
1399
1400
1400
if ( strlen ($ rnd_value ) < 8 ) {
1401
- $ seed = microtime ();
1402
- $ rnd_value = md5 ( uniqid (microtime () . mt_rand (), true ) . $ seed );
1403
- $ rnd_value .= sha1 ($ rnd_value );
1404
- $ rnd_value .= sha1 ($ rnd_value . $ seed );
1401
+
1402
+ $ notrandom = false ;
1403
+
1404
+ if ( function_exists ( 'openssl_random_pseudo_bytes ' ) ) {
1405
+
1406
+ $ rnd_value = bin2hex (openssl_random_pseudo_bytes (32 , $ cstrong ));
1407
+
1408
+ if ( ! $ cstrong ) {
1409
+
1410
+ $ notrandom = true ;
1411
+ }
1412
+
1413
+ } else {
1414
+
1415
+ $ notrandom = true ;
1416
+ }
1417
+
1418
+ if ( $ notrandom ) {
1419
+
1420
+ $ seed = microtime ();
1421
+ $ rnd_value = md5 ( uniqid (microtime () . mt_rand (), true ) . $ seed );
1422
+ $ rnd_value .= sha1 ($ rnd_value );
1423
+ $ rnd_value .= sha1 ($ rnd_value . $ seed );
1424
+
1425
+ }
1426
+
1405
1427
//$seed = md5($seed . $rnd_value);
1406
1428
}
1407
1429
// Take the first 8 digits for our value
You can’t perform that action at this time.
0 commit comments