diff options
| author | 2018-08-23 19:57:45 +0200 | |
|---|---|---|
| committer | 2018-08-23 19:57:45 +0200 | |
| commit | d38911e5b97725a28d12b07f3842a452e6acba36 (patch) | |
| tree | d021ff1ab21d69cae05bdfc48bf29d66ef02a905 /app/Controllers/javascriptController.php | |
| parent | 34d8be086c19cef6cbe236d4d541f460449852da (diff) | |
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. "
Diffstat (limited to 'app/Controllers/javascriptController.php')
| -rwxr-xr-x | app/Controllers/javascriptController.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/Controllers/javascriptController.php b/app/Controllers/javascriptController.php index 6336106a9..9d7acf647 100755 --- a/app/Controllers/javascriptController.php +++ b/app/Controllers/javascriptController.php @@ -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()); } } |
