From 7072c091a71e176a0cd57b91d570b26c8534870e Mon Sep 17 00:00:00 2001 From: ColonelMoutarde <4697568+ColonelMoutarde@users.noreply.github.com> Date: Thu, 23 Aug 2018 19:56:48 +0200 Subject: better rand() (#1978) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. " --- app/Controllers/feedController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/Controllers') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 168d5a661..2f7495884 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -413,7 +413,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $entryDAO->updateLastSeen($feed->id(), $oldGuids, $mtime); } - if ($feed_history >= 0 && rand(0, 30) === 1) { + if ($feed_history >= 0 && mt_rand(0, 30) === 1) { // TODO: move this function in web cron when available (see entry::purge) // Remove old entries once in 30. if (!$entryDAO->inTransaction()) { -- cgit v1.2.3