Download

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 > BlueprintUE.com | PasteBin For Unreal Engine 4

Function with random float generator inside (“Get Random Grass Tile By Height”): Get Random Grass > BlueprintUE.com | 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.