From 1909f9072e4d29faa33cfd4c27372969dfd52f1b Mon Sep 17 00:00:00 2001 From: Daku Date: Fri, 7 Feb 2014 15:51:13 +0000 Subject: [PATCH] use mt_rand() instead of rand() rand() isn't so random on windows: http://tjl.co/blog/code/followup-php-rand-vs-mt_rand/ mt_rand() is also slightly faster --- core/basethemelet.class.php | 2 +- themes/danbooru/themelet.class.php | 2 +- themes/danbooru2/themelet.class.php | 2 +- themes/futaba/themelet.class.php | 2 +- themes/lite/themelet.class.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/basethemelet.class.php b/core/basethemelet.class.php index 83632d08..f0b4d3ac 100644 --- a/core/basethemelet.class.php +++ b/core/basethemelet.class.php @@ -86,7 +86,7 @@ class BaseThemelet { private function build_paginator($current_page, $total_pages, $base_url, $query) { $next = $current_page + 1; $prev = $current_page - 1; - $rand = rand(1, $total_pages); + $rand = mt_rand(1, $total_pages); $at_start = ($current_page <= 1 || $total_pages <= 1); $at_end = ($current_page >= $total_pages); diff --git a/themes/danbooru/themelet.class.php b/themes/danbooru/themelet.class.php index db9b4116..37108666 100644 --- a/themes/danbooru/themelet.class.php +++ b/themes/danbooru/themelet.class.php @@ -42,7 +42,7 @@ class Themelet extends BaseThemelet { private function build_paginator($current_page, $total_pages, $base_url, $query) { $next = $current_page + 1; $prev = $current_page - 1; - $rand = rand(1, $total_pages); + $rand = mt_rand(1, $total_pages); $at_start = ($current_page <= 3 || $total_pages <= 3); $at_end = ($current_page >= $total_pages -2); diff --git a/themes/danbooru2/themelet.class.php b/themes/danbooru2/themelet.class.php index db9b4116..37108666 100644 --- a/themes/danbooru2/themelet.class.php +++ b/themes/danbooru2/themelet.class.php @@ -42,7 +42,7 @@ class Themelet extends BaseThemelet { private function build_paginator($current_page, $total_pages, $base_url, $query) { $next = $current_page + 1; $prev = $current_page - 1; - $rand = rand(1, $total_pages); + $rand = mt_rand(1, $total_pages); $at_start = ($current_page <= 3 || $total_pages <= 3); $at_end = ($current_page >= $total_pages -2); diff --git a/themes/futaba/themelet.class.php b/themes/futaba/themelet.class.php index 5fc79d3c..74f9fff8 100644 --- a/themes/futaba/themelet.class.php +++ b/themes/futaba/themelet.class.php @@ -50,7 +50,7 @@ class Themelet extends BaseThemelet { private function build_paginator($current_page, $total_pages, $base_url, $query) { $next = $current_page + 1; $prev = $current_page - 1; - $rand = rand(1, $total_pages); + $rand = mt_rand(1, $total_pages); $at_start = ($current_page <= 1 || $total_pages <= 1); $at_end = ($current_page >= $total_pages); diff --git a/themes/lite/themelet.class.php b/themes/lite/themelet.class.php index 8788d9a2..d88d6c78 100644 --- a/themes/lite/themelet.class.php +++ b/themes/lite/themelet.class.php @@ -67,7 +67,7 @@ class Themelet extends BaseThemelet { private function build_paginator($current_page, $total_pages, $base_url, $query) { $next = $current_page + 1; $prev = $current_page - 1; - $rand = rand(1, $total_pages); + $rand = mt_rand(1, $total_pages); $at_start = ($current_page <= 1 || $total_pages <= 1); $at_end = ($current_page >= $total_pages);