drawbot icon indicating copy to clipboard operation
drawbot copied to clipboard

ImageObject.randomGenerator() yields a constant result

Open chrisjansky opened this issue 1 year ago • 2 comments

Hello,

Despite the name random, the randomGenerator() method of ImageObject() yields the same result every time.

Minimal reproduction:

img = ImageObject()
img.randomGenerator((1000, 1000))
image(img, (0,0))

Is there a way to supply a seed parameter or perhaps instruct CoreImage to reinitialise to get a different result on each execution?

Thanks! :—)

chrisjansky avatar Jan 04 '24 08:01 chrisjansky

well the image generated is random to infinity only DrawBot cannot draw infinite images so it clips it to the given size, so you see always the same result

see https://developer.apple.com/library/archive/documentation/GraphicsImaging/Reference/CoreImageFilterReference/index.html#//apple_ref/doc/filter/ci/CIRandomGenerator

typemytype avatar Jan 04 '24 12:01 typemytype

@typemytype Thank you Frederik for clarifying. In other words there’s nothing that can be done to randomise the result at all?

What I am asking is if I draw a randomGenerator(size=(10, 10)), perhaps it would output a random (10, 10) crop of the infinite image?

chrisjansky avatar Jan 04 '24 17:01 chrisjansky