It requires typed arrays, if you want to use it in browsers without support you will need to use a polyfill like typedarray.js.
// initializing a simplex instance// do this only once it's relatively expensivevar simplex =value2d = simplexvalue3d = simplexvalue4d = simplex;
You can also pass an alternative random function to the constructor that is used to build the permutation table:
var simplex = Mathrandomvalue2d = simplex;
This can be used with a PRNG like alea to initialize the noise function with a seed:
var random = seedsimplex = randomvalue2d = simplex;
The ALEA PRNG can be found on npm.
Node.js is also supported, you can install the package using npm.
var SimplexNoise =simplex = Mathrandomvalue2d = simplex;
For development you can open
perf/index.html and watch the console or run
node perf/benchmark.js in a shell.
There is also a rake task for comparing your current changes can also run
The command works using git stash.
There are some simple buster.js tests for this library to run them first install buster.js and jshint:
npm install buster# if you haven't done so alreadynpm install -g jshintmake tests
Copyright (c) 2015 Jonas Wanger, licensed under the MIT License (enclosed)