-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
111 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export {default as uniform} from "./src/uniform"; | ||
export {default as normal} from "./src/normal"; | ||
export {default as logNormal} from "./src/logNormal"; | ||
export {default as bates} from "./src/bates"; | ||
export {default as irwinHall} from "./src/irwinHall"; | ||
export {default as exponential} from "./src/exponential"; | ||
export {default as randomUniform} from "./src/uniform"; | ||
export {default as randomNormal} from "./src/normal"; | ||
export {default as randomLogNormal} from "./src/logNormal"; | ||
export {default as randomBates} from "./src/bates"; | ||
export {default as randomIrwinHall} from "./src/irwinHall"; | ||
export {default as randomExponential} from "./src/exponential"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,48 @@ | ||
var tape = require("tape"), | ||
arrays = require("d3-arrays"), | ||
array = require("d3-array"), | ||
random = require("../"); | ||
|
||
require("seedrandom"); | ||
require("./inDelta"); | ||
|
||
var mathRandom = Math.random; | ||
|
||
tape.test("logNormal() returns random numbers with a log-mean of zero", function(test) { | ||
tape.test("randomLogNormal() returns random numbers with a log-mean of zero", function(test) { | ||
Math.seedrandom("a22ebc7c488a3a47"); | ||
test.inDelta(arrays.mean(arrays.range(10000).map(random.logNormal()), Math.log), 0, .05); | ||
test.inDelta(array.mean(array.range(10000).map(random.randomLogNormal()), Math.log), 0, .05); | ||
test.end(); | ||
}); | ||
|
||
tape.test("logNormal() returns random numbers with a log-standard deviation of one", function(test) { | ||
tape.test("randomLogNormal() returns random numbers with a log-standard deviation of one", function(test) { | ||
Math.seedrandom("06fd26b46c25607e"); | ||
test.inDelta(arrays.deviation(arrays.range(10000).map(random.logNormal()), Math.log), 1, .05); | ||
test.inDelta(array.deviation(array.range(10000).map(random.randomLogNormal()), Math.log), 1, .05); | ||
test.end(); | ||
}); | ||
|
||
tape.test("logNormal(mu) returns random numbers with the specified log-mean", function(test) { | ||
tape.test("randomLogNormal(mu) returns random numbers with the specified log-mean", function(test) { | ||
Math.seedrandom("fffe77600db5c1ad"); | ||
test.inDelta(arrays.mean(arrays.range(10000).map(random.logNormal(42)), Math.log), 42, .05); | ||
test.inDelta(arrays.mean(arrays.range(10000).map(random.logNormal(-2)), Math.log), -2, .05); | ||
test.inDelta(array.mean(array.range(10000).map(random.randomLogNormal(42)), Math.log), 42, .05); | ||
test.inDelta(array.mean(array.range(10000).map(random.randomLogNormal(-2)), Math.log), -2, .05); | ||
test.end(); | ||
}); | ||
|
||
tape.test("logNormal(mu) returns random numbers with a log-standard deviation of 1", function(test) { | ||
tape.test("randomLogNormal(mu) returns random numbers with a log-standard deviation of 1", function(test) { | ||
Math.seedrandom("9caf2156de45315a"); | ||
test.inDelta(arrays.deviation(arrays.range(10000).map(random.logNormal(42)), Math.log), 1, .05); | ||
test.inDelta(arrays.deviation(arrays.range(10000).map(random.logNormal(-2)), Math.log), 1, .05); | ||
test.inDelta(array.deviation(array.range(10000).map(random.randomLogNormal(42)), Math.log), 1, .05); | ||
test.inDelta(array.deviation(array.range(10000).map(random.randomLogNormal(-2)), Math.log), 1, .05); | ||
test.end(); | ||
}); | ||
|
||
tape.test("logNormal(mu, sigma) returns random numbers with the specified log-mean and log-standard deviation", function(test) { | ||
tape.test("randomLogNormal(mu, sigma) returns random numbers with the specified log-mean and log-standard deviation", function(test) { | ||
Math.seedrandom("c0d761f591fb5e43"); | ||
test.inDelta(arrays.mean(arrays.range(10000).map(random.logNormal(42, 2)), Math.log), 42, .05); | ||
test.inDelta(arrays.mean(arrays.range(10000).map(random.logNormal(-2, 2)), Math.log), -2, .05); | ||
test.inDelta(arrays.deviation(arrays.range(10000).map(random.logNormal(42, 2)), Math.log), 2, .05); | ||
test.inDelta(arrays.deviation(arrays.range(10000).map(random.logNormal(-2, 2)), Math.log), 2, .05); | ||
test.inDelta(array.mean(array.range(10000).map(random.randomLogNormal(42, 2)), Math.log), 42, .05); | ||
test.inDelta(array.mean(array.range(10000).map(random.randomLogNormal(-2, 2)), Math.log), -2, .05); | ||
test.inDelta(array.deviation(array.range(10000).map(random.randomLogNormal(42, 2)), Math.log), 2, .05); | ||
test.inDelta(array.deviation(array.range(10000).map(random.randomLogNormal(-2, 2)), Math.log), 2, .05); | ||
test.end(); | ||
}); | ||
|
||
tape("logNormal() [teardown]", function(test) { | ||
tape("randomLogNormal() [teardown]", function(test) { | ||
Math.random = mathRandom; | ||
test.end(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,48 @@ | ||
var tape = require("tape"), | ||
arrays = require("d3-arrays"), | ||
array = require("d3-array"), | ||
random = require("../"); | ||
|
||
require("seedrandom"); | ||
require("./inDelta"); | ||
|
||
var mathRandom = Math.random; | ||
|
||
tape.test("normal() returns random numbers with a mean of zero", function(test) { | ||
tape.test("randomNormal() returns random numbers with a mean of zero", function(test) { | ||
Math.seedrandom("a22ebc7c488a3a47"); | ||
test.inDelta(arrays.mean(arrays.range(10000).map(random.normal())), 0, .05); | ||
test.inDelta(array.mean(array.range(10000).map(random.randomNormal())), 0, .05); | ||
test.end(); | ||
}); | ||
|
||
tape.test("normal() returns random numbers with a standard deviation of one", function(test) { | ||
tape.test("randomNormal() returns random numbers with a standard deviation of one", function(test) { | ||
Math.seedrandom("06fd26b46c25607e"); | ||
test.inDelta(arrays.deviation(arrays.range(10000).map(random.normal())), 1, .05); | ||
test.inDelta(array.deviation(array.range(10000).map(random.randomNormal())), 1, .05); | ||
test.end(); | ||
}); | ||
|
||
tape.test("normal(mu) returns random numbers with the specified mean", function(test) { | ||
tape.test("randomNormal(mu) returns random numbers with the specified mean", function(test) { | ||
Math.seedrandom("fffe77600db5c1ad"); | ||
test.inDelta(arrays.mean(arrays.range(10000).map(random.normal(42))), 42, .05); | ||
test.inDelta(arrays.mean(arrays.range(10000).map(random.normal(-2))), -2, .05); | ||
test.inDelta(array.mean(array.range(10000).map(random.randomNormal(42))), 42, .05); | ||
test.inDelta(array.mean(array.range(10000).map(random.randomNormal(-2))), -2, .05); | ||
test.end(); | ||
}); | ||
|
||
tape.test("normal(mu) returns random numbers with a standard deviation of 1", function(test) { | ||
tape.test("randomNormal(mu) returns random numbers with a standard deviation of 1", function(test) { | ||
Math.seedrandom("9caf2156de45315a"); | ||
test.inDelta(arrays.deviation(arrays.range(10000).map(random.normal(42))), 1, .05); | ||
test.inDelta(arrays.deviation(arrays.range(10000).map(random.normal(-2))), 1, .05); | ||
test.inDelta(array.deviation(array.range(10000).map(random.randomNormal(42))), 1, .05); | ||
test.inDelta(array.deviation(array.range(10000).map(random.randomNormal(-2))), 1, .05); | ||
test.end(); | ||
}); | ||
|
||
tape.test("normal(mu, sigma) returns random numbers with the specified mean and standard deviation", function(test) { | ||
tape.test("randomNormal(mu, sigma) returns random numbers with the specified mean and standard deviation", function(test) { | ||
Math.seedrandom("c0d761f591fb5e43"); | ||
test.inDelta(arrays.mean(arrays.range(10000).map(random.normal(42, 2))), 42, .05); | ||
test.inDelta(arrays.mean(arrays.range(10000).map(random.normal(-2, 2))), -2, .05); | ||
test.inDelta(arrays.deviation(arrays.range(10000).map(random.normal(42, 2))), 2, .05); | ||
test.inDelta(arrays.deviation(arrays.range(10000).map(random.normal(-2, 2))), 2, .05); | ||
test.inDelta(array.mean(array.range(10000).map(random.randomNormal(42, 2))), 42, .05); | ||
test.inDelta(array.mean(array.range(10000).map(random.randomNormal(-2, 2))), -2, .05); | ||
test.inDelta(array.deviation(array.range(10000).map(random.randomNormal(42, 2))), 2, .05); | ||
test.inDelta(array.deviation(array.range(10000).map(random.randomNormal(-2, 2))), 2, .05); | ||
test.end(); | ||
}); | ||
|
||
tape("normal() [teardown]", function(test) { | ||
tape("randomNormal() [teardown]", function(test) { | ||
Math.random = mathRandom; | ||
test.end(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.