We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b0f0d6f commit cfb18efCopy full SHA for cfb18ef
underscore.js
@@ -1203,15 +1203,12 @@
1203
};
1204
1205
// Return a random integer between min and max (inclusive).
1206
- // Note the subtraction of 1e-16, to prevent a very occasional error where we'd
1207
- // return max + 1 due to rounding (see
1208
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random)
1209
_.random = function(min, max) {
1210
if (max == null) {
1211
max = min;
1212
min = 0;
1213
}
1214
- return min + Math.floor(Math.random() * (max - min + 1 - 1e-16));
+ return min + Math.floor(Math.random() * (max - min + 1));
1215
1216
1217
// A (possibly faster) way to get the current timestamp as an integer.
0 commit comments