Bug in adding random float logic

I am taking coord of random created block and add to him one from 4 vectors [(1,0),(-1,0),(0,1),(0,-1)]. I create 2 logic but all of them doesn’t work and it adds vector (1,1) or (1,-1) etc. Why does it happened?

Logic is not multiplayer ( No replications and server events )

Print string: red = input, blue = output

Not sure what you mean but the most common assumption is that the random returns the same value with subsequent calls. This is not true. In your GetNextCoord function it’s used twice, giving you, potentially, 2 different values.

To prevent this, create a local int, store the random value first and then use it twice. This will ensure the same random is used for as long as the function is in scope.

I already fixed it by returning one var vector, saving it, and adding it to my coords outside. But you are right, for two different variables it calls two times and it was my fault