Branch not working?

Im having an issue with using a branch…

im generating a random number in a trigger box. (no trigger is being used, just standard event tick for the moment.)
if the random number is <= 50 then it =true. otherwise = false.
if true print string “Hello”. if false print string “Boolean result” + “random number generated”. (Image provided below)

This is the result of the event tick. some weird things are happening. you can see the false branch printing true with a numbers <=50 when it should be using the true branch. as well as the false branch also printing false with a number <=50 which should be true. some ticks work correctly but some dont. not sure why.

283121-truefalse.png

i tried using different random number generators for ints and floats, neither changed anything.

I believe this is happening due to the tick node. You know, it’s called every frame… So probably the branch is been called again before the previous branch node have finished it’s execution, so it’s printing true (from the current value) and then the number from the previous frame (wich was <= 50).

Try using the trigger event and see if it works.

Yes functions that don’t have execution pins are pure functions and will be executed once for every pin they are connected to.

Each connection to the “Round” evaluates the fomula (random+round) separately.

So for the lower right “PrintString” you are calling it again, obtaining a new random result, which has nothing to do with the first result when evaluating the “<=50+Branch”

One solution would be to temporarily store it in a variable, and use the variable for further processing.