Random number gen in For Loop generates same number

For some reason, a random number generator nestled within a For Loop will generate the same number consecutively. Only changing generated numbers after a random amount of time of generating the same number.

I suppose the only thing that may need be known is that the function for the loop is called from within the editor.

This works fine, how does your BP differ?

1 Like

Here,

Full Function with for (each) loop: Generate Grass - Random Nestled within For Loop posted by X1D3F4K4 | blueprintUE | PasteBin For Unreal Engine 4

Function with random float generator inside (“Get Random Grass Tile By Height”): Get Random Grass posted by X1D3F4K4 | blueprintUE | PasteBin For Unreal Engine 4

Hopefully this extra information will prove useful.

Thanks. I also tried it this way, and the node always generates different numbers. I also find nothing in google about it I’m afraid…

Ok, no problem - thanks for trying but, just for completeness’ sake, did you call the initial function from inside the editor?

I did it like you, called a function inside a BP ( from inside the editor ).

Thanks then, ill comment here again if I ever figure out what shenanigans are afoot.

1 Like

Hey @X1D3F4H6K4, this may sound like a dumb question, but could you try right-clicking your “Random Float” function and hitting “Collapse to Function”? Sometimes odd problems can arise from the “pure” blueprint nodes not being enough times, whereas with an impure function, you can directly control the execution.

1 Like

From what I can surmise right now, the problem arose from the 2d Perlin Noise plugin I was using, and it interfered with the generation of the random floats. I’ve used another randomization function library as a stop-gap for the meantime, however I’ll swap the plugin with something else to the same end.

1 Like