# Best way to randomly put a mc off stage?

**URL:** <https://forum.kirupa.com/t/best-way-to-randomly-put-a-mc-off-stage/29389>\
**Category:** Uncategorized\
**Created:** [August 26, 2003, 10:34am UTC](https://forum.kirupa.com/t/best-way-to-randomly-put-a-mc-off-stage/29389 "2003-08-26T10:34:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![keitai](https://avatars.discourse-cdn.com/v4/letter/k/73ab20/32.png) [@keitai](https://forum.kirupa.com/u/keitai)\
**Post date:** [August 26, 2003, 10:34am UTC](https://forum.kirupa.com/t/best-way-to-randomly-put-a-mc-off-stage/29389/1 "2003-08-26T10:34:59Z")

</div>

Hi,

Wondering what the best way is to randomly put a mc off stage?

My movie is 400x300

So to put it on stage i would use something like

this.\_x = myRandom(0, 400);  
this.\_y = myRandom(0,300);

function myRandom (minVal, maxVal) {  
return minVal + Math.floor(Math.random() \*(maxVal+1 - minVal));   
}

So how can i convert it to an offstage function

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 26, 2003, 1:15pm UTC](https://forum.kirupa.com/t/best-way-to-randomly-put-a-mc-off-stage/29389/2 "2003-08-26T13:15:36Z")

</div>

Well, you could do the same, with an \_x position between -300 and 0 or 400 and 700, and the same for \_y, no?

pom 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 26, 2003, 1:25pm UTC](https://forum.kirupa.com/t/best-way-to-randomly-put-a-mc-off-stage/29389/3 "2003-08-26T13:25:04Z")

</div>

thnks,

what was i thinking.

portfolioBtn.\_x = myRandom (-300, 0 || 400,700);  
portfolioBtn.\_y = myRandom (-300,0 || 300, 700);

btw could you take a look at my other post

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 26, 2003, 1:30pm UTC](https://forum.kirupa.com/t/best-way-to-randomly-put-a-mc-off-stage/29389/4 "2003-08-26T13:30:23Z")

</div>

That || is highly suspicious. You’re better off randomly choosing between the 2 intervals 🙂
