summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2011-01-16 23:06:19 -0800
committerBharat Mediratta <bharat@menalto.com>2011-01-16 23:06:19 -0800
commit167f635a6ce5a71b35450844f9b5c647aa14bcc1 (patch)
tree2eed5fb84725b5767f5793e6c2ca47ec50a04486
parent70abfb2a20734802c922c0e9917d2a1778aef3f2 (diff)
Add arguments to random::int() to match mt_rand(). Follow on to cd48b89f3166e7fa732b5cb06d33fba018af9127
for #1527.
-rw-r--r--modules/gallery/helpers/random.php8
1 files changed, 6 insertions, 2 deletions
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