Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Math. to random() #64

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions simplex-noise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,14 +479,14 @@
* Do not rely on this export.
* @private
*/
export function buildPermutationTable(random: RandomFn): Uint8Array {

Check warning on line 482 in simplex-noise.ts

View workflow job for this annotation

GitHub Actions / tests (12.x)

'random' is defined but never used

Check warning on line 482 in simplex-noise.ts

View workflow job for this annotation

GitHub Actions / tests (14.x)

'random' is defined but never used

Check warning on line 482 in simplex-noise.ts

View workflow job for this annotation

GitHub Actions / tests (16.x)

'random' is defined but never used

Check warning on line 482 in simplex-noise.ts

View workflow job for this annotation

GitHub Actions / tests (17.x)

'random' is defined but never used
const tableSize = 512;
const p = new Uint8Array(tableSize);
for (let i = 0; i < tableSize / 2; i++) {
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 @@
p[i] = p[i - 256];
}
return p;
}
}
Loading