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.
 
 
 
 

15 lines
402 B

import defaultSource from "./defaultSource.js";
export default (function sourceRandomIrwinHall(source) {
function randomIrwinHall(n) {
if ((n = +n) <= 0) return () => 0;
return function() {
for (var sum = 0, i = n; i > 1; --i) sum += source();
return sum + i * source();
};
}
randomIrwinHall.source = sourceRandomIrwinHall;
return randomIrwinHall;
})(defaultSource);