|
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:
424 bytes
|
| Line | |
|---|
| 1 | import defaultSource from "./defaultSource.js";
|
|---|
| 2 | import gamma from "./gamma.js";
|
|---|
| 3 |
|
|---|
| 4 | export default (function sourceRandomBeta(source) {
|
|---|
| 5 | var G = gamma.source(source);
|
|---|
| 6 |
|
|---|
| 7 | function randomBeta(alpha, beta) {
|
|---|
| 8 | var X = G(alpha),
|
|---|
| 9 | Y = G(beta);
|
|---|
| 10 | return function() {
|
|---|
| 11 | var x = X();
|
|---|
| 12 | return x === 0 ? 0 : x / (x + Y());
|
|---|
| 13 | };
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | randomBeta.source = sourceRandomBeta;
|
|---|
| 17 |
|
|---|
| 18 | return randomBeta;
|
|---|
| 19 | })(defaultSource);
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.