# Random Appearance

**URL:** <https://forum.kirupa.com/t/random-appearance/102312>\
**Category:** Uncategorized\
**Created:** [February 22, 2004, 4:11am UTC](https://forum.kirupa.com/t/random-appearance/102312 "2004-02-22T04:11:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RejectProductio](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@RejectProductio](https://forum.kirupa.com/u/RejectProductio)\
**Post date:** [February 22, 2004, 4:11am UTC](https://forum.kirupa.com/t/random-appearance/102312/1 "2004-02-22T04:11:24Z")

</div>

I am making a First-person shooter and I was wondering if anyone knows the code for making people randomly pop put of their hiding places. So like the person comes out of the same place, but at a random time after some others. Anyone know?

---

<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:** [February 22, 2004, 11:52pm UTC](https://forum.kirupa.com/t/random-appearance/102312/2 "2004-02-22T23:52:15Z")

</div>

first:  
I think this question belongs in the Game programming forum…

second:  
take a look at the setInterval() functoin, combined with the Math.random() function.

for example:

[AS]  
doThis = function () {  
trace(“Whatever”);  
clearInterval(itv);  
};  
itv = setInterval(doThis, Math.round(Math.random()\*10000));  
[/AS]
