|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
402 bytes
|
| Rev | Line | |
|---|
| [e4c61dd] | 1 | import defaultSource from "./defaultSource.js";
|
|---|
| 2 |
|
|---|
| 3 | export 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.