|
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:
478 bytes
|
| Line | |
|---|
| 1 | import defaultSource from "./defaultSource.js";
|
|---|
| 2 | import irwinHall from "./irwinHall.js";
|
|---|
| 3 |
|
|---|
| 4 | export default (function sourceRandomBates(source) {
|
|---|
| 5 | var I = irwinHall.source(source);
|
|---|
| 6 |
|
|---|
| 7 | function randomBates(n) {
|
|---|
| 8 | // use limiting distribution at n === 0
|
|---|
| 9 | if ((n = +n) === 0) return source;
|
|---|
| 10 | var randomIrwinHall = I(n);
|
|---|
| 11 | return function() {
|
|---|
| 12 | return randomIrwinHall() / n;
|
|---|
| 13 | };
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | randomBates.source = sourceRandomBates;
|
|---|
| 17 |
|
|---|
| 18 | return randomBates;
|
|---|
| 19 | })(defaultSource);
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.