robbmcleod / pyfastnoisesimd

Python module wrapping C++ FastNoiseSIMD
BSD 3-Clause "New" or "Revised" License
39 stars 6 forks source link

seed is not respected #24

Closed jgostick closed 3 years ago

jgostick commented 3 years ago

When passing seed to the Noise class, it seems to get overwritten by the subsequent operations like setting octaves. For instance, if I do perlin.seed = 0 just before generating the image then it works and a consistent image is returned. On the other hand if I do perlin.seed = 0 followed other operations then perlin.seed do not return 0.

robbmcleod commented 3 years ago

Can you provide an example please, I don't see this on my end when I tested using example/orthographic_projection.py.

jgostick commented 3 years ago

Hmmm, I am only able to reproduce half the problem. The seed argument is not respected.

>>> perlin = fns.Noise(numWorkers=1, seed=0)
>>> print(perlin.seed == 0)
False

However, when I assign seed to the perlin object it does seem to persist. Not sure why I was find it didn't before:

>>> perlin = fns.Noise(numWorkers=1)
>>> perlin.seed = 0
>>> print(perlin.seed == 0)
True
>>> perlin.noiseType = fns.NoiseType.PerlinFractal
>>> print(perlin.seed == 0)
True
robbmcleod commented 3 years ago

Ok I see, it was checking against bool(seed) so specifically for the seed of 0 it would not work, and only in the constructor. Closing.