diff --git a/src/interpolation/helpers.js b/src/interpolation/helpers.js index 2bf620c..4d97a4e 100644 --- a/src/interpolation/helpers.js +++ b/src/interpolation/helpers.js @@ -24,10 +24,10 @@ export function takeSampleFrom(sourceList, amount) { } for (let i = 0; i < amount; ++i) { - let rand = sourceList[Math.floor((Math.random() * max))]; + let rand = sourceList[Math.floor(Math.random() * max)]; // Re-random until suitable value is found. while (randElements.includes(rand)) { - rand = sourceList[Math.floor((Math.random() * max))]; + rand = sourceList[Math.floor(Math.random() * max)]; } randElements.push(rand); } diff --git a/src/neighbourSampling.js b/src/neighbourSampling.js index 9914cc2..eb8de26 100644 --- a/src/neighbourSampling.js +++ b/src/neighbourSampling.js @@ -126,10 +126,10 @@ export default function () { break; } - let rand = Math.floor((Math.random() * max)); + let rand = Math.floor(Math.random() * max); // Re-random until suitable value is found. while (randElements.includes(rand) || exclude.includes(rand)) { - rand = Math.floor((Math.random() * max)); + rand = Math.floor(Math.random() * max); } randElements.push(rand); } diff --git a/src/t-sne.js b/src/t-sne.js index 996bf18..3cbade4 100644 --- a/src/t-sne.js +++ b/src/t-sne.js @@ -52,7 +52,7 @@ export default function() { let u = 2 * Math.random() - 1; let v = 2 * Math.random() - 1; let r = u * u + v * v; - if (r == 0 || r > 1) return gaussRandom(); + if (r == 0 || r > 1) {return gaussRandom();} return u * Math.sqrt(-2 * Math.log(r) / r); } @@ -74,7 +74,7 @@ export default function() { * @return {Float64Array} - array of zeros with length n. */ function zeros(n) { - if (typeof(n) === 'undefined' || isNaN(n)) { + if (typeof n === 'undefined' || isNaN(n)) { return []; } return new Float64Array(n); // typed arrays are faster