From 24461ad4ca9265cfe1b6a34e06f9354bbf820f58 Mon Sep 17 00:00:00 2001 From: shish Date: Fri, 7 Nov 2008 11:46:34 +0000 Subject: [PATCH] Image::by_random fix from artanis git-svn-id: file:///home/shish/svn/shimmie2/trunk@1106 7f39781d-f577-437e-ae19-be835c7a54ca --- core/image.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/image.class.php b/core/image.class.php index e533c8ab..2127f708 100644 --- a/core/image.class.php +++ b/core/image.class.php @@ -48,7 +48,7 @@ class Image { public static function by_random(Config $config, Database $database, $tags=array()) { $max = Image::count_images($config, $database, $tags); - $rand = mt_rand(0, $max); + $rand = mt_rand(0, $max-1); $set = Image::find_images($config, $database, $rand, 1, $tags); if(count($set) > 0) return $set[0]; else return null;