Better rand() (#1976)

http://php.net/manual/en/function.mt-rand.php

from php Doc

"Many random number generators of older libcs have dubious or unknown characteristics and are slow. The mt_rand() function is a drop-in replacement for the older rand(). It uses a random number generator with known characteristics using the » Mersenne Twister, which will produce random numbers four times faster than what the average libc rand() provides. "
This commit is contained in:
ColonelMoutarde
2018-08-23 19:57:45 +02:00
committed by Alexandre Alapetite
parent 34d8be086c
commit d38911e5b9

View File

@@ -47,8 +47,8 @@ class FreshRSS_javascript_Controller extends Minz_ActionController {
$this->view->salt1 = sprintf('$2a$%02d$', FreshRSS_user_Controller::BCRYPT_COST);
$alphabet = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for ($i = 22; $i > 0; $i--) {
$this->view->salt1 .= $alphabet[rand(0, 63)];
$this->view->salt1 .= $alphabet[mt_rand(0, 63)];
}
$this->view->nonce = sha1(rand());
$this->view->nonce = sha1(mt_rand());
}
}