hasard
Version:
Random variables and random nested objects manipulation in javascript
13 lines (12 loc) • 310 B
JavaScript
module.exports = function (t, actualHasard, individualExpectation, globalExpectation = null) {
const n = 1000;
return actualHasard.runAsync(n).then(res => {
t.is(res.length, n);
res.forEach(a => {
individualExpectation(t, a);
});
if (globalExpectation) {
globalExpectation(t, res);
}
});
};