# Random x movement?

**URL:** <https://forum.kirupa.com/t/random-x-movement/124427>\
**Category:** Uncategorized\
**Created:** [October 3, 2004, 5:26pm UTC](https://forum.kirupa.com/t/random-x-movement/124427 "2004-10-03T17:26:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Limitlis](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/limitlis/32/788_2.png) [@Limitlis](https://forum.kirupa.com/u/Limitlis)\
**Post date:** [October 3, 2004, 5:26pm UTC](https://forum.kirupa.com/t/random-x-movement/124427/1 "2004-10-03T17:26:17Z")

</div>

Hi eveyone,

I have a question about random movement on X axis.

I need it to bring me both positive and negative numbers??

I’ve tired the random(num); script and it works to make it go right.

My script is

```
	this._x += speedx + **random(100)**;
	speedy = this._y -= speedy;
	pressing = 0;

```

What’s the simplest way to get a random number either both a positive number or a negative?

ANy help is greatly appreciated.

Thanks in advanced,  
Limitlis :cap:
