### Author Topic: [SOLVED] More Random Problems  (Read 198 times)

#### CodeRunner

I'm having a lot of issues with randomness working correctly. Or perhaps I just don't understand how to make the best use of it.

I created a tool graph that will be employed by a secondary graph that will be employed by a parent graph. The tool graph randomly offsets the image, using a transform, by a random amount between -1 and +1. I do this by randomly generating a value between 0-2 and subtracting 1 (so 2->random->minus1). However, when I change the random seed of the tool graph by 1, the image literally moves by about 0.01. And when I change it by +1 again, it moves by the exact same amount again. This means the random value is directly offset by the random seed, by a very specific, predictable amount.

If I place 4 instances of the tool graph into the secondary graph, and choose completely different random seeds for each one (such as 21, 191, 361, 691), then add them all into a single image with blend nodes, it looks good at first. But guess what happens when I choose a different random seed for the secondary graph? All four instances of the tool graph remain in-sync, and all of them offset by the same amount, regardless of what random seed I choose. There is no way to get them to offset differently from one another. How do I get all four of them to offset by a different, random amount?

If this is just how things are, then this is not how randomness should work. If a random seed is offset by a single digit, the output should be completely randomized again, right? Not just the same result as last time plus X. Otherwise, the random seed has a direct association with the randomly generated value. A user wanting a different result doesn't get a different result - just the same result scooted over.

This situation is easy to replicate, so I won't bother uploading a graph unless someone wants me to. I just need help understanding how to make things randomize. Thanks!
Last Edit: May 31, 2019, 12:16:03 pm

#### Nicolas Wirrmann

Unfortunately that's the way it works at the moment.

In therms of UI we should probably put a "Randomize" button next to the slider so that you can manually pick a seed rather than incrementing the seed value by 1 unit at a time.
Product Manager - Allegorithmic

#### CodeRunner

I could get behind that, but I'm still not able to have 4 instances of the same (tool) graph randomly offset by different amounts. Regardless of what random seed I choose in the parent graphs, all 4 instances offset in sync with each other.

Since we're not supposed to use multiplication to generate random seeds, it means all 4 of them are the same value plus some arbitrary hard-coded value. Which means they will always be in sync, regardless of what that value is.

Is there any way to do this? To have all four instances offset randomly, independently from each other?

One thought is that I may be able to generate 4 random values in the parent graph and feed them into the tool graphs using the new value processors. I think this might give me real randomness. This is another reason to add that feature I've been asking for - random inheritance, where child graphs can rely on the same random pool as parent graphs.

Is there a simpler way to pull it off?

Thanks for the help!

EDIT: I just realized I can just expose the offset and send a random value that way from the parent graph without a value processor. Oops. This is probably the best way to handle it?

EDIT2: Nevermind that edit. When a value is exposed from a graph and the function for it uses a random output on the parent graph, it still generates from the internal graph random seed apparently. So value processors may indeed be required.
Last Edit: May 29, 2019, 02:44:33 pm

#### CodeRunner

For future searcher record, the value processor concept seems to work pretty well. I created a graph that generates 4 random values (vector 4) using a value processor, then had to create a graph to swizzle the components apart for each instance of the sub graph (tool graph). This allows the sub graphs to all rely on the same random generation pool, which means they are all independently random. They all rely on and use the same random seed.

Having multiple graphs rely on the same random pool is extremely important and needs to be a feature! It would also be so very easy to add this feature. It may even already be possible through some hack I haven't considered (apart from value processors). But it should definitely be added to the UI as a simple option. Just an extra option in the random seed type drop down. "inherit from parent graph"