add lisp packages
This commit is contained in:
15
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/bates.js
generated
vendored
Normal file
15
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/bates.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import defaultSource from "./defaultSource";
|
||||
import irwinHall from "./irwinHall";
|
||||
|
||||
export default (function sourceRandomBates(source) {
|
||||
function randomBates(n) {
|
||||
var randomIrwinHall = irwinHall.source(source)(n);
|
||||
return function() {
|
||||
return randomIrwinHall() / n;
|
||||
};
|
||||
}
|
||||
|
||||
randomBates.source = sourceRandomBates;
|
||||
|
||||
return randomBates;
|
||||
})(defaultSource);
|
||||
3
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/defaultSource.js
generated
vendored
Normal file
3
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/defaultSource.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function() {
|
||||
return Math.random();
|
||||
}
|
||||
13
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/exponential.js
generated
vendored
Normal file
13
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/exponential.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import defaultSource from "./defaultSource";
|
||||
|
||||
export default (function sourceRandomExponential(source) {
|
||||
function randomExponential(lambda) {
|
||||
return function() {
|
||||
return -Math.log(1 - source()) / lambda;
|
||||
};
|
||||
}
|
||||
|
||||
randomExponential.source = sourceRandomExponential;
|
||||
|
||||
return randomExponential;
|
||||
})(defaultSource);
|
||||
6
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/index.js
generated
vendored
Normal file
6
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export {default as randomUniform} from "./uniform";
|
||||
export {default as randomNormal} from "./normal";
|
||||
export {default as randomLogNormal} from "./logNormal";
|
||||
export {default as randomBates} from "./bates";
|
||||
export {default as randomIrwinHall} from "./irwinHall";
|
||||
export {default as randomExponential} from "./exponential";
|
||||
14
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/irwinHall.js
generated
vendored
Normal file
14
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/irwinHall.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import defaultSource from "./defaultSource";
|
||||
|
||||
export default (function sourceRandomIrwinHall(source) {
|
||||
function randomIrwinHall(n) {
|
||||
return function() {
|
||||
for (var sum = 0, i = 0; i < n; ++i) sum += source();
|
||||
return sum;
|
||||
};
|
||||
}
|
||||
|
||||
randomIrwinHall.source = sourceRandomIrwinHall;
|
||||
|
||||
return randomIrwinHall;
|
||||
})(defaultSource);
|
||||
15
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/logNormal.js
generated
vendored
Normal file
15
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/logNormal.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import defaultSource from "./defaultSource";
|
||||
import normal from "./normal";
|
||||
|
||||
export default (function sourceRandomLogNormal(source) {
|
||||
function randomLogNormal() {
|
||||
var randomNormal = normal.source(source).apply(this, arguments);
|
||||
return function() {
|
||||
return Math.exp(randomNormal());
|
||||
};
|
||||
}
|
||||
|
||||
randomLogNormal.source = sourceRandomLogNormal;
|
||||
|
||||
return randomLogNormal;
|
||||
})(defaultSource);
|
||||
28
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/normal.js
generated
vendored
Normal file
28
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/normal.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import defaultSource from "./defaultSource";
|
||||
|
||||
export default (function sourceRandomNormal(source) {
|
||||
function randomNormal(mu, sigma) {
|
||||
var x, r;
|
||||
mu = mu == null ? 0 : +mu;
|
||||
sigma = sigma == null ? 1 : +sigma;
|
||||
return function() {
|
||||
var y;
|
||||
|
||||
// If available, use the second previously-generated uniform random.
|
||||
if (x != null) y = x, x = null;
|
||||
|
||||
// Otherwise, generate a new x and y.
|
||||
else do {
|
||||
x = source() * 2 - 1;
|
||||
y = source() * 2 - 1;
|
||||
r = x * x + y * y;
|
||||
} while (!r || r > 1);
|
||||
|
||||
return mu + sigma * y * Math.sqrt(-2 * Math.log(r) / r);
|
||||
};
|
||||
}
|
||||
|
||||
randomNormal.source = sourceRandomNormal;
|
||||
|
||||
return randomNormal;
|
||||
})(defaultSource);
|
||||
17
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/uniform.js
generated
vendored
Normal file
17
lisp/emacs-application-framework/app/mermaid/node_modules/d3-random/src/uniform.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import defaultSource from "./defaultSource";
|
||||
|
||||
export default (function sourceRandomUniform(source) {
|
||||
function randomUniform(min, max) {
|
||||
min = min == null ? 0 : +min;
|
||||
max = max == null ? 1 : +max;
|
||||
if (arguments.length === 1) max = min, min = 0;
|
||||
else max -= min;
|
||||
return function() {
|
||||
return source() * max + min;
|
||||
};
|
||||
}
|
||||
|
||||
randomUniform.source = sourceRandomUniform;
|
||||
|
||||
return randomUniform;
|
||||
})(defaultSource);
|
||||
Reference in New Issue
Block a user