# Random function

**URL:** <https://forum.kirupa.com/t/random-function/137389>\
**Category:** Uncategorized\
**Created:** [February 14, 2005, 5:42am UTC](https://forum.kirupa.com/t/random-function/137389 "2005-02-14T05:42:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![borispc](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@borispc](https://forum.kirupa.com/u/borispc)\
**Post date:** [February 14, 2005, 5:42am UTC](https://forum.kirupa.com/t/random-function/137389/1 "2005-02-14T05:42:23Z")

</div>

Hello! 😟

What is the best way to find a random number that is not equal to two specific values?  
ex:

1. find random number (let’s say from 0 to 5)
2. check if the result is not 4 or 5
3. If it is, run the random function again and again until the condition is met.

Or maybe there’s a way to set up that at once (find random number that is not equal to 4 or 5).  
Thanks!
