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
This commit is contained in:
parent
c065e38145
commit
1909f9072e
@ -86,7 +86,7 @@ class BaseThemelet {
|
|||||||
private function build_paginator($current_page, $total_pages, $base_url, $query) {
|
private function build_paginator($current_page, $total_pages, $base_url, $query) {
|
||||||
$next = $current_page + 1;
|
$next = $current_page + 1;
|
||||||
$prev = $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_start = ($current_page <= 1 || $total_pages <= 1);
|
||||||
$at_end = ($current_page >= $total_pages);
|
$at_end = ($current_page >= $total_pages);
|
||||||
|
@ -42,7 +42,7 @@ class Themelet extends BaseThemelet {
|
|||||||
private function build_paginator($current_page, $total_pages, $base_url, $query) {
|
private function build_paginator($current_page, $total_pages, $base_url, $query) {
|
||||||
$next = $current_page + 1;
|
$next = $current_page + 1;
|
||||||
$prev = $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_start = ($current_page <= 3 || $total_pages <= 3);
|
||||||
$at_end = ($current_page >= $total_pages -2);
|
$at_end = ($current_page >= $total_pages -2);
|
||||||
|
@ -42,7 +42,7 @@ class Themelet extends BaseThemelet {
|
|||||||
private function build_paginator($current_page, $total_pages, $base_url, $query) {
|
private function build_paginator($current_page, $total_pages, $base_url, $query) {
|
||||||
$next = $current_page + 1;
|
$next = $current_page + 1;
|
||||||
$prev = $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_start = ($current_page <= 3 || $total_pages <= 3);
|
||||||
$at_end = ($current_page >= $total_pages -2);
|
$at_end = ($current_page >= $total_pages -2);
|
||||||
|
@ -50,7 +50,7 @@ class Themelet extends BaseThemelet {
|
|||||||
private function build_paginator($current_page, $total_pages, $base_url, $query) {
|
private function build_paginator($current_page, $total_pages, $base_url, $query) {
|
||||||
$next = $current_page + 1;
|
$next = $current_page + 1;
|
||||||
$prev = $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_start = ($current_page <= 1 || $total_pages <= 1);
|
||||||
$at_end = ($current_page >= $total_pages);
|
$at_end = ($current_page >= $total_pages);
|
||||||
|
@ -67,7 +67,7 @@ class Themelet extends BaseThemelet {
|
|||||||
private function build_paginator($current_page, $total_pages, $base_url, $query) {
|
private function build_paginator($current_page, $total_pages, $base_url, $query) {
|
||||||
$next = $current_page + 1;
|
$next = $current_page + 1;
|
||||||
$prev = $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_start = ($current_page <= 1 || $total_pages <= 1);
|
||||||
$at_end = ($current_page >= $total_pages);
|
$at_end = ($current_page >= $total_pages);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user