mrdoob / texgen.js

JavaScript Texture Generator
http://texgenjs.org/
MIT License
1.8k stars 130 forks source link

Make Noise seedable #22

Closed DGruenwald closed 9 years ago

DGruenwald commented 9 years ago

Changed Math.random() to the Xorshift random number algorithm and added ability to set the seed, so, if needed, you can always get the same noise pattern.

This is my very first contribution to a project. If I did something wrong, please tell me!

mrdoob commented 9 years ago

I think it would be nicer if it was just params.seed. Isn't there a noise algorithm that takes only one value? How about PRNG?

var value = (param.seed * 16807) % 2147483647;

(Sorry for the delay btw!)

DGruenwald commented 9 years ago

Yes, that does look much better. I don't know what I was thinking...

mrdoob commented 9 years ago

Sweet! Many thanks!