UNPKG

@compactjs/random

Version:

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

3 lines (2 loc) 243 B
exports.pick=function(o){return o[Math.floor(Math.random()*o.length)]},exports.random=function(o,n){return void 0===o?Math.random():void 0===n?Math.random()*o:o>n?Math.random()*(o-n)+n:Math.random()*(n-o)+o}; //# sourceMappingURL=index.js.map