davbol
|
noiseSeed()
Nov 7th, 2006, 12:37am
The noiseSeed() function only works once, and only if called before noise(). It will not RE-seed the perlin noise routines once they'be been seeded. I believe the problem is the internal perlin[] array that only gets created once, but should probably be repopulated from scratch whenever noiseSeed() is called.
To demonstrate, run this sketch and note seed 0 value:
noiseSeed(0); // make a rng with seed 0 noise(0,0,0); // fill perlin[] with seed 0 println(noise(0,0,0)); // prints 0.6852823
Then run this sketch and note seed 12345 value:
noiseSeed(12345); // make a rng with seed 12345 noise(0,0,0); // fill perlin[] with seed 12345 println(noise(0,0,0)); // prints 0.33919036
Then run this sketch and note that seed 12345 returns seed 0's value:
noiseSeed(0); // make a rng with seed 0 noise(0,0,0); // fill perlin[] with seed 0 noiseSeed(12345); // make a rng with seed 12345 noise(0,0,0); // does not repopulate perlin[], still from seed 0 println(noise(0,0,0)); // prints 0.6852823
|