Skip to content

Commit

Permalink
spelling: weight
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
  • Loading branch information
jsoref committed Aug 14, 2022
1 parent d301d14 commit 85f9403
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/matrix_builder.js
Expand Up @@ -9,7 +9,7 @@ class Axis {
this.values = values;
// If all entries have same weight, the axis has uniform distribution
this.uniform = values.reduce((a, b) => a === (b.weight || 1) ? a : 0, values[0].weight || 1) !== 0
this.totalWeigth = this.uniform ? values.length : values.reduce((a, b) => a + (b.weight || 1), 0);
this.totalWeight = this.uniform ? values.length : values.reduce((a, b) => a + (b.weight || 1), 0);
}

static matches(row, filter) {
Expand Down Expand Up @@ -47,7 +47,7 @@ class Axis {
if (this.uniform) {
return values[Math.floor(Math.random() * values.length)];
}
const totalWeight = !filter ? this.totalWeigth : values.reduce((a, b) => a + (b.weight || 1), 0);
const totalWeight = !filter ? this.totalWeight : values.reduce((a, b) => a + (b.weight || 1), 0);
let weight = Math.random() * totalWeight;
for (let i = 0; i < values.length; i++) {
const value = values[i];
Expand Down

0 comments on commit 85f9403

Please sign in to comment.