UNPKG

@compactjs/random

Version:

Simple module to generate random values from a given range or array

3 lines (2 loc) 419 B
!function(n,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((n=n||self).random={})}(this,function(n){n.pick=function(n){return n[Math.floor(Math.random()*n.length)]},n.random=function(n,o){return void 0===n?Math.random():void 0===o?Math.random()*n:n>o?Math.random()*(n-o)+o:Math.random()*(o-n)+n}}); //# sourceMappingURL=index.umd.js.map