From 167f635a6ce5a71b35450844f9b5c647aa14bcc1 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 16 Jan 2011 23:06:19 -0800 Subject: Add arguments to random::int() to match mt_rand(). Follow on to cd48b89f3166e7fa732b5cb06d33fba018af9127 for #1527. --- modules/gallery/helpers/random.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/gallery/helpers/random.php b/modules/gallery/helpers/random.php index a26762bd..dfc7558c 100644 --- a/modules/gallery/helpers/random.php +++ b/modules/gallery/helpers/random.php @@ -42,9 +42,13 @@ class random_Core { } /** - * Return a random number between 0 and mt_getrandmax() + * Return a random number between $min and $max. If $min and $max are not specified, + * return a random number between 0 and mt_getrandmax() */ - static function int() { + static function int($min=null, $max=null) { + if ($min || $max) { + return mt_rand($min, $max); + } return mt_rand(); } } \ No newline at end of file -- cgit v1.2.3