jwagner / simplex-noise.js

A fast simplex noise implementation in Javascript / Typescript.
MIT License
1.61k stars 130 forks source link

Adding Math. to random() #64

Closed Falling10fruit closed 7 months ago

Falling10fruit commented 7 months ago

I got an error in the debug console:

Uncaught TypeError: random is not a function at buildPermutationTable (simplex-noise.js:505:22)

jwagner commented 7 months ago

Thanks for the PR @Falling10fruit.

As you can see from the test results, it breaks everything though. Random should be the variable random (coming in as an argument) and not math.random. It's likely that the code triggering the error you posted is passing in an invalid random function into simplex-noise If you share the code to reproduce the error I can help you to pin down the issue.

Before opening future PR please run the tests first. I should probably add a contributing file to the Repo to make this more clear.

Falling10fruit commented 7 months ago

Alright never mind I forgot that I wasn't supposed to directly use the createNoise functions.

And now all it does is return zero, should I make an issue? Codepen VSCode

jwagner commented 7 months ago

From the API Docs

Coordinates should be finite, bigger than -2^31 and smaller than 2^31.

If you can avoid it, also don't sample at exact integer coordinates.

Falling10fruit commented 7 months ago

Alright thanks