Skip to content

Commit 80006c7

Browse files
committed
Fixed OBOB bug in RandomInt function
Fixes #26
1 parent 6f71d30 commit 80006c7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/utils.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ module.exports.buildNaturalLangList = function(items, finalWord, hyphenize) {
5353
return output;
5454
};
5555

56+
/**
57+
* Returns a random integer between low and high (inclusive)
58+
* @param low
59+
* @param high
60+
* @returns {number}
61+
*/
5662
module.exports.randomInt = function(low, high) {
57-
return Math.floor(Math.random() * (high - low) + low);
63+
return Math.floor(Math.random() * (high - low + 1) + low);
5864
};

0 commit comments

Comments
 (0)