|
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:
396 bytes
|
| Line | |
|---|
| 1 | import defaultSource from "./defaultSource.js";
|
|---|
| 2 |
|
|---|
| 3 | export default (function sourceRandomPareto(source) {
|
|---|
| 4 | function randomPareto(alpha) {
|
|---|
| 5 | if ((alpha = +alpha) < 0) throw new RangeError("invalid alpha");
|
|---|
| 6 | alpha = 1 / -alpha;
|
|---|
| 7 | return function() {
|
|---|
| 8 | return Math.pow(1 - source(), alpha);
|
|---|
| 9 | };
|
|---|
| 10 | }
|
|---|
| 11 |
|
|---|
| 12 | randomPareto.source = sourceRandomPareto;
|
|---|
| 13 |
|
|---|
| 14 | return randomPareto;
|
|---|
| 15 | })(defaultSource);
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.