Integer Comparison Giving Inconsistent True/False


I am new to Unreal Engine and am running into an issue trying to compare some integers. I am generating a random number from an array from 0-3 and when I print out the number generated and then print the result of the compare node I am sometimes getting true when it is false and false when it is true. I attached an image of the current node structure and the output window showing the results of the comparison. To my knowledge it should only be returning true if the integer is 1 and false for every other number.

Thanks, Adam

Pure functions - functions without an execution pin - will be called for every line connected to it. And in this case, calling it will make it generate a new result, you’ll end up with different results.
What you do is temporarily save the result to a variable and work with that variable instead.

Thanks! This will be super helpful moving forward. I actually accidentally fixed it by running the RNG from outside the function and now your explanation makes perfect sense as to why it now works.