You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

23 lines
424 B

// Park-Miller-Carta Pseudo-Random Number Generator
// https://github.com/pnitsch/BitmapData.js/blob/master/js/BitmapData.js
var PRNG = function () {
this.seed = 1;
this.next = function() {
return ( this.gen() / 2147483647 );
};
this.nextRange = function( min, max ) {
return min + ( ( max - min ) * this.next() )
};
this.gen = function() {
return this.seed = ( this.seed * 16807 ) % 2147483647;
};
};