aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar ColonelMoutarde <4697568+ColonelMoutarde@users.noreply.github.com> 2018-08-23 19:57:08 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2018-08-23 19:57:08 +0200
commit34d8be086c19cef6cbe236d4d541f460449852da (patch)
tree493c562d2922392caeb055f48c4da33578085782
parent7072c091a71e176a0cd57b91d570b26c8534870e (diff)
Better rand() (#1977)
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. "
-rw-r--r--p/f.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/p/f.php b/p/f.php
index 81df8984b..b68109cd5 100644
--- a/p/f.php
+++ b/p/f.php
@@ -28,7 +28,7 @@ $txt_mtime = @filemtime($txt);
header('Content-Type: image/x-icon');
-if ($ico_mtime == false || $ico_mtime < $txt_mtime || ($ico_mtime < time() - (rand(15, 20) * 86400))) {
+if ($ico_mtime == false || $ico_mtime < $txt_mtime || ($ico_mtime < time() - (mt_rand(15, 20) * 86400))) {
if ($txt_mtime == false) {
show_default_favicon(1800);
exit();
@@ -49,6 +49,6 @@ if ($ico_mtime == false || $ico_mtime < $txt_mtime || ($ico_mtime < time() - (ra
header('Content-Disposition: inline; filename="' . $id . '.ico"');
-if (!httpConditional($ico_mtime, rand(14, 21) * 86400, 2)) {
+if (!httpConditional($ico_mtime, mt_rand(14, 21) * 86400, 2)) {
readfile($ico);
}