Equal (integer) sometimes doesn't work

So, while I was programming, I noticed while testing that something didn’t work, but when I go check what happened, I found out something very awkward (see the images). I have no idea why this happens, and the strangest thing that I found, is that this bug only happens sometimes, in other words, if I test my game once, the bug could either happen or not. I don’t need any help for now, I programmed a different code that ends with the same result and it worked, I just wanted to let you guys know about this bug.

I actually think this is working as intended.
To the best of my knowledge, Random Integer in Range is re-evaluated (and generates a new random number), each time the upstream links are evaluated.

As a result, in the code you’ve shown, it will generate a different random number for each of the if statements it encounters, rather than the same one each time. It’s a subtle gotcha, if you want to use the same random number more than once, you have to store it in a variable first.

So it seems likely that the number generated when you mouse over the boolean is different to the one you get when you mouse over the Random Integer in Range node, and so the comparison might indeed be false for the new number.

Pure functions - those without execute wire going in and out, getting evaluated every time when their output used.

there are switch on int, which you might want to use for your case; also there are switch on pretty much all basic data types, as well as select.