summaryrefslogtreecommitdiff
path: root/js/utility.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/utility.js')
-rw-r--r--js/utility.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/js/utility.js b/js/utility.js
index ab67cd2..a59841f 100644
--- a/js/utility.js
+++ b/js/utility.js
@@ -1,3 +1,14 @@
-function range(min, max) {
- return Math.floor(Math.random() * (max - min + 1)) + min;
-} \ No newline at end of file
+/**
+ * Returns a random integer between min and max
+ *
+ * @param {Number} min
+ * @param {Number} max
+ * @return {Number}
+ */
+Math.rangeInt = function(min, max){
+ if (max == undefined) {
+ max = min;
+ min = 0;
+ }
+ return Math.floor(Math.random() * (max - min + 1)) + min;
+}