You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Well, It's because of the bitwise operator (it only supports 32-bit integers). Don't know if it's a design decision in favor of speed( since that bitwise op is a bit faster than Math.floor), but using Math.floor instead of the bitwise op inside the function should do the job for you.
in underscore
_.random = function(min, max) {
if (max == null) {
max = min;
min = 0;
}
return min + (0 | Math.random() * (max - min + 1));
};
return value may lte min, I found this by testing new Date().getTime() as args
the code (0 | Math.random() * (max - min + 1)) with
( 0 | 11531563792 ) returns -1353338096
The text was updated successfully, but these errors were encountered: