UNPKG

underscore-es

Version:

javaScript's functional programming helper library for ES6 and beyond.

11 lines (10 loc) 280 B
// `_random` : an utility's function // ---------------------------------- // Return a random integer between min and max (inclusive). export default function (min, max) { if (max == null) { max = min; min = 0; } return min + Math.floor(Math.random() * (max - min + 1)); }