# randomHiLo()

**URL:** <https://forum.kirupa.com/t/randomhilo/179881>\
**Category:** flash\
**Created:** [February 23, 2006, 6:27pm UTC](https://forum.kirupa.com/t/randomhilo/179881 "2006-02-23T18:27:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sammo](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sammo/32/779_2.png) [@Sammo](https://forum.kirupa.com/u/Sammo)\
**Post date:** [February 23, 2006, 6:27pm UTC](https://forum.kirupa.com/t/randomhilo/179881/1 "2006-02-23T18:27:06Z")

</div>

```auto
randomHiLo = function (x, y) {
	if (x > y) return null;
	else return Math.floor(Math.random()*(y-x))+x;
}

```

Just a quick function I made because I’m sick of the long-winded way flash handles random numbers now. This function selects a random number between x and y. An example:

```auto
trace(randomHiLo(30,60));

```

Could output 53.
