mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 17:01:26 +02:00
2 is magic.
This commit is contained in:
parent
4241f4b305
commit
31d72ffb8d
1 changed files with 4 additions and 1 deletions
|
@ -29,7 +29,10 @@ function virtualBatonf(options) {
|
||||||
// Answer averages (number +/- variability). Avoids having everyone act in lockstep.
|
// Answer averages (number +/- variability). Avoids having everyone act in lockstep.
|
||||||
function randomize(number, variability) {
|
function randomize(number, variability) {
|
||||||
var allowedDeviation = number * variability;
|
var allowedDeviation = number * variability;
|
||||||
return number - allowedDeviation + (Math.random() * 2 * allowedDeviation);
|
var theNumberThatIsTwice = 2;
|
||||||
|
// random() is (0, 1], averages 0.5. The average of twice that is 1.
|
||||||
|
var randomDeviation = Math.random() * theNumberThatIsTwice * allowedDeviation;
|
||||||
|
return number - allowedDeviation + randomDeviation;
|
||||||
}
|
}
|
||||||
// Allow testing outside in a harness outside of High Fidelity.
|
// Allow testing outside in a harness outside of High Fidelity.
|
||||||
// See sourceCodeSandbox/tests/mocha/test/testVirtualBaton.js
|
// See sourceCodeSandbox/tests/mocha/test/testVirtualBaton.js
|
||||||
|
|
Loading…
Reference in a new issue