Random Streams broken(Bug?)

I don’t know if this is a bug but will tag it like so, I don’t wanna do a bug report due to the extremely slow response, the general complexity of a report, the fact I don’t wanna share project files, go through the arduous task of remaking a project with random streams to even attempt to test something like this. And the fact it’s by and large; hidden from the community.

I’ve been working on a dungeon generator for the past few weeks and by far the hardest part is getting my thing to work with random streams.(Which should be simple I literally just want to pass along a user set seed into my dungeon gen function.)

I already had it finished for months, I’m merely updating it to improve it and instead of it being pure random I wanted to update all the random gen numbers to derive from a seed, simple right? Wrong. It is not that simple.

You thought you could just get a seed from the date/time and then cast to the bp that generates it, create a stream variable from that and then pass by reference into the dungeon generator and fill in all the random ints in range to use a seed? That is stupid and will never work.

Instead the seed will generate similarly enough, that I thought it was working. But it instead has a few “sets” it will go through for each seed.

Say I set the seed to “0” and then everything generates ‘x way’ for the first n tests, but then it will generate ‘y way’ which is completely different, then it will generate ‘y way’ for a while and then flip back to ‘x way’.

I don’t know why the function choose a couple different ways to generate per seed.

It is just being passed by reference into the function, it is being set in a different bp by the player and then the dungeon generator function casts to that bp, gets the stream, and promotes it to a variable.

Am I completely misunderstanding seeds? I was under the assumption they could produce “predictable random”. Any help appreciated, I can’t really show code as it is quite expansive but feel free to ask for a specific part I could chop out for you.

Edit: The seed is not being changed anywhere order of ops is thus;

  1. Seed is set by player or date/time if none is chosen.
  2. bp with seed is casted too and the seed is promoted to a variable.
  3. seed goes into dungeon gen function(pass by ref)
  4. seed goes into each collapsed graph for every part of the function.

Some graphs work with it passed as ref some don’t, it seems to be entirely random and some functions generate the same stuff for each seed and some don’t. Hence the reason I think it’s a bug, but I want to see if anyone else has ideas as to why this may be happening like this.

Edit: Over 2 months old still no answer. Streams absolutely will not work in some functions for no real reason besides “no” passed by ref or not some do work, some don’t. Any help appreciated I can’t advance my level gen until this is solved.


like millionth edit: Still having this issue, bump? There’s no way I’m the only one having this issue random streams are so integral to rng that there’s gotta be someone else dealing with this not translating to functions for 0 reason.

From what I saw of your code on this, you understand the point of seeds, but for some reason, when you come to code it, you ignore what you already seem to know about them.

It’s very simple, just make a variable of type RandomStream. In the details of that variable, you can set the seed. From then on, every time you use RandomIntInRangeFromStream ( for instance ), it will produce a random but predictable stream of numbers.

It always starts in the same place and will always follow the same, but random, order.

If you want the stream to act differently, you change the seed.

This IS the concept you have in your head, and you have it right, but for some reason, when you come to write the code, you are changing the seed during your blueprint.

If you want it to stay the same, you have to leave the seed the same.

I’m afraid I’m not at a machine right now and can’t really check any of this.

Are you somehow ending up using different instances of the same variable?

If you make a BP and fix the seed, I think the seed will still change for other instances of the same BP.

Well I’ve only got one blueprint that uses the seed running. Is it possible that somehow multiple seed instances are being used off of the one variable?

Is there a difference between passing a seed by ref into a collapsed graph vs a function? What about nested graphs and functions?

I’m leaning towards possible bug since it’s literally just getting the seed from it’s bp and using that promoted variable into the functions. If I print string after every function the seed is the same; yet I get different level results. And oddly enough it seems to flip-flop between a couple different configurations.

But it isn’t being changed.

  1. I cast to the user settings bp to get the “dungeon seed”. (That is either random gen from the time or the player manually setting it.)
  2. I use the cast to set that as a variable(random stream variable)
  3. I use that variable and reroute nodes to put it into collapsed graphs and functions.

I have nothing interacting with it at all beyond that, no resets, no setters, no breaks or makes and no changing the stream.

I’m passing it by reference but it is all coming from one variable ref and that’s the one that is initially set from the cast.

One variable is one variable, that’s it. It doesn’t matter how much you pass it around. Passing by reference only makes a different if you want to modify the variable.

I did notice, however, you mentioned ‘promoted’ there in your text. The only way you can promote a variable, is when it’s new - IE a new instance. When are you promoting, can you show that bit of code?

Compress graphs make no difference, the compression is just a display convenience.

Passing variables into functions also makes no difference, do not pass by reference unless you intend to make updates.

Hmm I was having trouble with the seed giving me the same results over and over again when fed into loops. I came across [this thread][1] that said to pass by ref into functions and it solved my issues. (this was a while ago and isn’t my current issue)

But some of my functions take it as by ref and some don’t, for some reason if I have it passed by ref into the main functions they work and if I don’t I have those problems above. Even more weird the collapsed graphs within those functions do not have it passed by ref. most of the gen seems to work correctly if I do it this way. But some still don’t use the seed correctly.

But onto the promoted values.

I then just get that variable and reroute node it into every function as an input, all the master functions have “pass by ref” on in their inputs and then it is rerouted into the collapsed graphs in those functions.

Hmm I was having trouble with the seed
giving me the same results over and
over again when fed into loops.

But… that’s what you want, no!?..

I think we’re having a communication break down here.

Naturally, you will be able to change the seed if you pass it by reference, but that’s not what to do with the seed.

I don’t know why my reply isn’t showing up but if you read the thread I linked it explains the reason for passing as ref better. Basically if it isn’t passed as ref a function treats it like the same everytime.

So loop on the seed would select number 2 or something from a range. And then do it as a 2 for every iteration of the loop.

But that doesn’t matter anyways because my functions treat the seed as different everytime for some reason.