# Integer Comparison Giving Inconsistent True/False

**URL:** <https://forums.unrealengine.com/t/integer-comparison-giving-inconsistent-true-false/469146>\
**Category:** Platform & Builds\
**Tags:** Switch, compare, unreal-engine, Blueprint, question\
**Created:** [August 8, 2020, 10:13pm UTC](https://forums.unrealengine.com/t/integer-comparison-giving-inconsistent-true-false/469146 "2020-08-08T22:13:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_9e8b2af2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9e8b2af2](https://forums.unrealengine.com/u/anonymous_user_9e8b2af2)\
**Post date:** [August 8, 2020, 10:13pm UTC](https://forums.unrealengine.com/t/integer-comparison-giving-inconsistent-true-false/469146/1 "2020-08-08T22:13:23Z")

</div>

Hi,

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,

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [August 8, 2020, 10:17pm UTC](https://forums.unrealengine.com/t/integer-comparison-giving-inconsistent-true-false/469146/2 "2020-08-08T22:17:44Z")

</div>

I don’t think it inconsistent comparison but pure node call order issue, the random node getting called twice randomizing 2 different numbers. Try using single print string with string append and display a number and compare in single callm this will ensure what truly a issue

---

<div class="post-metadata">

**Author:** ![mightyenigma](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mightyenigma](https://forums.unrealengine.com/u/mightyenigma)\
**Post date:** [August 10, 2020, 8:01pm UTC](https://forums.unrealengine.com/t/integer-comparison-giving-inconsistent-true-false/469146/3 "2020-08-10T20:01:24Z")

</div>

I agree with @anonymous_user_f5a50610 - a common pitfall when coding in blueprints is not to realize the following:

- Each time a node with a white execution pin runs, then all of the other nodes plugged into it run, whether they just ran for the previous node or not.
- If you want the same random number as the last time, you need to save it to a variable and refer to that variable instead of running a wire back to the random number function node. Otherwise you will run it AGAIN and get a different number.
