Random array item from stream - if using hardcoded value, causes infinite loop. Why?

Hi, I have a question for those familiar with using random streams.

I have two random streams and I am using them in very similar ways. One case works, the other does not. First I’ll show the one that does work:

When setting up a new game, I check if a save game exist. If not, I seed a random stream and store the seed as an integer variable here:

That integer variable gets saved so that I can load the same seed later on.

How it gets used is here:

There is an array of possible choices, and the seed is used to select from them. This all functions as expected, meaning that the random set of “control points” I produce with the “Exercise Stream Seed” gets saved and loaded and is the same every time I load the same save slot.

Now to the part that does not work. I use another Random Stream to randomly select from an array in another place, but if I try to use an integer variable I get an infinite loop error. Here:

With the “Identifier Stream” struct plugged in, no infinite loop. But I can’t use it that way because if I load the game multiple times, it increments the value we are accessing in the stream. So I need to plug in the integer variable like I’ve done earlier, but then I get the infinite loop error.

I am sure there is something about Random Streams that I am not understanding here. Hopefully I’ve explained this clear. Any help even if it’s just a suggestion for a troubleshooting step would be appreciated. I’m pretty stumped here, I don’t know what I can do to learn anything more.

ForLoop with a Loopback??? :disappointed: Loopbacks always require a delay!!! But delays can’t be added to a ForLoop not like this anyway (search BP threads for ForLoop+Delay special case). Solution: Create your own ForLoop (inc an int connected to Get) or take out the Loopback. :wink:

I’m always leery of the word “always” :slight_smile:
In this case the problem was solved like this:

I simply needed to clear the Array “used identifiers”. The problem was that we were running out of identifiers to check, thus leading to the loop checking an array of zero.

Whoever is saying you always have to have a delay in this case should look at this example. I don’t know enough to argue about it, but we can see here that it is working.

Code looks unsafe, a loopback like that is infinite loop territory imho.
If you’re doing similar things elsewhere, you’ll get burned eventually.
But hey lets bump the thread anyway and try and get more opinions… :+1: