Page 1 of 1

Repeatable Randomness

Posted: Sun Sep 13, 2015 2:25 am
by nik282000
I'm working on animating some Context Free Art and I noticed that even when you define the random see with /v
the "randomness" is quite different if any of the variables in the code have changed. In my example I am changing
the "r" value in one location. Is the way that weighted rules get picked influenced by the rule's contents and might
there be a way I can work around this to have "random" trees that branch at the same step regardless of the rest
of the variables?

If not I can think of a few ways to simulate the randomness I am looking for but none of them would produce
trees as nice as the built in Context Free Art engine.

Thanks,
-Nick

Re: Repeatable Randomness

Posted: Mon Sep 14, 2015 11:02 am
by MtnViewJohn
Context Free uses a tree of random number seeds instead of a global pseudo-random number generator. This is done so that a variation doesn't change radically when you change the rendering resolution. To keep things interesting, the actual text of each shape replacement in a rule is reduced to a 64-bit value that we call its "entropy". This entropy value gets exclusive-ORed into the random seed during the shape replacement. If you change the text of a shape replacement then you change the entropy, which changes the randomness of the descendent shapes.

The solution to your problem is simple. If you have a value that you want to change without affecting randomness then store this value in a global variable and reference the global variable in your shape rules. The entropy of a variable is derived from its name, not its value. So you can change a value without affecting randomness.

Re: Repeatable Randomness

Posted: Mon Sep 14, 2015 5:20 pm
by nik282000
Awesome! Thanks for the explanation and easy fix too!