Random sequence of numbers

Hey everyone,

I’m working on a process node that generates a sequence of random values and advances it each time the Step Forward input is set to True — A becomes B, and B becomes a new value that is different from A. My goal is to keep the sequence consistent and ensure there are no duplicates in each number pair.

After a few different attempts, I came up with the following solution:

It works well overall, but it has two drawbacks:

  1. Initialization issue: On startup, A and B are always equal. On the next cycle, B is correctly randomized (so it’s not equal to A). As a temporary workaround, I added an “Initialized” output for cases where this behavior matters.
  2. Seed control: I can’t reliably change the seed. This isn’t a major issue in my setup, but I noticed some non-deterministic behavior when updating the seed at runtime. Occasionally, this causes the sequence to break — A becomes equal to B. After several consecutive seed changes, it sometimes returns to the correct state (A ≠ B), but later it may break again.

Does anyone know a reliable way to generate two random values that meet the initial condition (A ≠ B, both random) on the very first frame, while still maintaining the ability to advance the sequence later on? Changing the seed at runtime would be also nice (the sequence can be reset in that case, e.g. new pair is fine)

RND.vl (21.2 KB)

RND_forum

This option is not suitable if you need to dynamically change the range, but it can be modified. The seed can also be supplied externally.

1 Like

Thank you very much!