source: node_modules/d3-random/src/irwinHall.js@ a762898

Last change on this file since a762898 was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Prototype 1.1

  • Property mode set to 100644
File size: 402 bytes
Line 
1import defaultSource from "./defaultSource.js";
2
3export default (function sourceRandomIrwinHall(source) {
4 function randomIrwinHall(n) {
5 if ((n = +n) <= 0) return () => 0;
6 return function() {
7 for (var sum = 0, i = n; i > 1; --i) sum += source();
8 return sum + i * source();
9 };
10 }
11
12 randomIrwinHall.source = sourceRandomIrwinHall;
13
14 return randomIrwinHall;
15})(defaultSource);
Note: See TracBrowser for help on using the repository browser.