@nichathan-gaming/map-generator
Version:
Creates and generates a 2 dimensional array with various path generation functions.
37 lines (29 loc) • 679 B
JavaScript
import seedrandom from "seedrandom";
class random{
static seed;
static rand;
static setSeed(seed){
if(seed){
this.rand = seedrandom(seed);
this.seed = seed;
} else {
this.rand = null;
this.seed = null;
};
return this;
};
static getNextSeeded(seed){
if(this.seed === seed){
return this.getNext();
};
this.setSeed(seed);
this.getNext();
}
static getNext(){
if(this.rand){
return this.rand();
};
return Math.random();
};
};
export default random;