# How do you get random numbers within a range that doesn't include the current integer?

**URL:** <https://forums.unrealengine.com/t/how-do-you-get-random-numbers-within-a-range-that-doesnt-include-the-current-integer/373862>\
**Category:** Blueprint\
**Tags:** random, range, integer, unreal-engine, Blueprint, question\
**Created:** [October 20, 2016, 1:42am UTC](https://forums.unrealengine.com/t/how-do-you-get-random-numbers-within-a-range-that-doesnt-include-the-current-integer/373862 "2016-10-20T01:42:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_1786a85d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1786a85d](https://forums.unrealengine.com/u/anonymous_user_1786a85d)\
**Post date:** [October 20, 2016, 1:42am UTC](https://forums.unrealengine.com/t/how-do-you-get-random-numbers-within-a-range-that-doesnt-include-the-current-integer/373862/1 "2016-10-20T01:42:40Z")

</div>

Hello,  
I have a problem that I need to solve. What I want to happen is a random integer to be chosen within a range that isn’t a certain integer. For example: Random Integer within 0 - 20 that is not 18. I’m not sure how to tackle this one.

Thank you.

---

<div class="post-metadata">

**Author:** ![Night\_Watcher](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/night_watcher/32/1145400_2.png) [@Night\_Watcher](https://forums.unrealengine.com/u/Night_Watcher)\
**Post date:** [October 20, 2016, 2:02am UTC](https://forums.unrealengine.com/t/how-do-you-get-random-numbers-within-a-range-that-doesnt-include-the-current-integer/373862/2 "2016-10-20T02:02:39Z")

</div>

Pick a random number from range 0 to 20, and if it’s 18, then pick another one.

Or

pick a randomly between a 2 random generators that have respectively a range of 0-17 and 19-20 with a respective probability of 18/20 and 2/20

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1786a85d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1786a85d](https://forums.unrealengine.com/u/anonymous_user_1786a85d)\
**Post date:** [November 25, 2016, 5:24am UTC](https://forums.unrealengine.com/t/how-do-you-get-random-numbers-within-a-range-that-doesnt-include-the-current-integer/373862/3 "2016-11-25T05:24:57Z")

</div>

Found my answer.

> **[How do I get 4 different random integers from a range?](https://forums.unrealengine.com/questions/528431/how-do-i-get-4-different-random-integers-from-a-ra.html)**
>
> Hello, I’ve been trying to solve this question for quite a while now: how would I get 4 different random integers from a range. I have a range that four integers need to be picked out of: 0-24. These four integers can’t be the same, because these...

Have a good day.
