Skip to content

Commit

Permalink
Adding Math. to random()
Browse files Browse the repository at this point in the history
I got an error in the debug console:

Uncaught TypeError: random is not a function
    at buildPermutationTable (simplex-noise.js:505:22)
  • Loading branch information
Falling10fruit authored Jan 22, 2024
1 parent c3ff219 commit a4d2d97
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions simplex-noise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ export function buildPermutationTable(random: RandomFn): Uint8Array {
p[i] = i;
}
for (let i = 0; i < tableSize / 2 - 1; i++) {
const r = i + ~~(random() * (256 - i));
const r = i + ~~(Math.random() * (256 - i));
const aux = p[i];
p[i] = p[r];
p[r] = aux;
Expand All @@ -495,4 +495,4 @@ export function buildPermutationTable(random: RandomFn): Uint8Array {
p[i] = p[i - 256];
}
return p;
}
}

0 comments on commit a4d2d97

Please sign in to comment.