You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

16 lines
404 B

import defaultSource from "./defaultSource.js";
export default (function sourceRandomInt(source) {
function randomInt(min, max) {
if (arguments.length < 2) max = min, min = 0;
min = Math.floor(min);
max = Math.floor(max) - min;
return function() {
return Math.floor(source() * max + min);
};
}
randomInt.source = sourceRandomInt;
return randomInt;
})(defaultSource);