Claire
8/7/2017 - 11:52 PM

example random with seed in javascript

example random with seed in javascript

function Rando(inSeed) {
    origSeed =  inSeed || Date.now();
    
    result = { 
        // the initial seed
        origseed : origSeed,
        
        seed : origSeed,

        seededRandom : function(max, min) {
            max = max || 1;
            min = min || 0;

            this.seed = (this.seed * 9301 + 49297) % 233280;
            var rnd = this.seed / 233280;

            return min + rnd * (max - min);
            }
	}
	return result;
}