I have read in the documentation that you can pass an object that has a random method for custom stuff so in my case
I have done
import { SimplexNoise } from 'three/examples/jsm/math/SimplexNoise.js';
class wrapper {
public randomFunc;
constructor(seed:number){
this.randomFunc = mulberry32(seed);
}
public random(){
return this.randomFunc;
}
}
function mulberry32(seed:number) {
return function() {
let t = (seed += 0x6D2B79F5);
t = Math.imul(t ^ (t >>> 15), t | 1);
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
const wrappedRandom = new wrapper(1)
const noise = new SimplexNoise(wrappedRandom);
const raw = noise.noise(1, 1);
console.log(raw)
however this results in
at SimplexNoise._dot (SimplexNoise.js:452:10)
at SimplexNoise.noise (SimplexNoise.js:123:24)
at test.ts:25:19
simply turning it to const noise = new SimplexNoise(); fixes it, but why? whats causing this to have issues?