im going to go out on a limb here and guess that you have your script setup and you were testing so you added in a print string to see the value. if thats the case then you have likely made the same issue that many people have and not realized that whenever the random node is called it will change its value. so lets say as an example that you have one random int node and plug it into two print strings one after the other, that will result in the random int being called twice which will give two different numbers.
for your specific case to solve your issue simply get the random number then immediately store that in a variable. then use the variable for your checks. the variables value wont change so you can use it as many times as needed.