## 5 years ago by FelipeBudinich

Code can be found here

This plugins allows you to generate pseudorandom numbers using a Mersenne Twister.

This plugin is based on the MT19937 algorithm, and code by Ben Lesh

As a submodule, from the git command line:

Then require this module:

This method returns a pseudorandom float number between 0 and 1, including both.

This method returns a pseudorandom integer number between

This method returns a pseudorandom float number between

**Impact JS Mersenne Twister Plugin**This plugins allows you to generate pseudorandom numbers using a Mersenne Twister.

This plugin is based on the MT19937 algorithm, and code by Ben Lesh

**Installation**As a submodule, from the git command line:

git submodule add https://github.com/Talesay/impact-plugin-mersenne-twister.git lib/plugins/mersenne

Then require this module:

'plugins.array.utilities'

**Constructor**var prng = new ig.MersenneTwister(seed);

**seed:**An Integer to be used as the initial seed for the pseudorandom number generator, if undefined Date.now() will be used.**Usage**var prng = new ig.MersenneTwister(1); pnrg.get(); 0.057725428480649384 pnrg.get(); 0.8143797201814594 var prng = new ig.MersenneTwister(42); pnrg.getFloatRange(3,7); 4.8493376279088585 pnrg.getIntRange(-7, 5); -2

**.get()**This method returns a pseudorandom float number between 0 and 1, including both.

**.getIntRange(min, max)**This method returns a pseudorandom integer number between

*min*and*max*, including both.**.getFloatRange(min, max)**This method returns a pseudorandom float number between

*min and max*, including both.