Permalink
Browse files

fix dumb error in randomInt

  • Loading branch information...
1 parent ad5487e commit 7ca3cf53907c77ffd7e617e72e3e93cf47ceb559 @dominictarr committed Nov 30, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 random.js
View
@@ -1,10 +1,10 @@
var randomInt = exports.randomInt = function (min, max) {
- min = min || 1
- max = max || 100
+ min = min == null ? 1 : min
+ max = max == null ? 100 : max
return Math.round(Math.random()*(max - min)) + min
}
exports.randomOf = function (array) {
- return array[randomInt(0, array.length)]
+ return array[randomInt(0, array.length - 1)]
}

0 comments on commit 7ca3cf5

Please sign in to comment.