From a4d2d97acbaa0dd251a1cfa7bcad1483f098c86c Mon Sep 17 00:00:00 2001 From: Budiyoga Date: Mon, 22 Jan 2024 11:28:10 +0700 Subject: [PATCH] Adding Math. to random() I got an error in the debug console: Uncaught TypeError: random is not a function at buildPermutationTable (simplex-noise.js:505:22) --- simplex-noise.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simplex-noise.ts b/simplex-noise.ts index d99471a..71f8446 100644 --- a/simplex-noise.ts +++ b/simplex-noise.ts @@ -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; @@ -495,4 +495,4 @@ export function buildPermutationTable(random: RandomFn): Uint8Array { p[i] = p[i - 256]; } return p; -} \ No newline at end of file +}