# Random integers

**URL:** <https://forum.kirupa.com/t/random-integers/89144>\
**Category:** flash\
**Created:** [May 5, 2005, 11:22am UTC](https://forum.kirupa.com/t/random-integers/89144 "2005-05-05T11:22:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lord\_Rahl](https://avatars.discourse-cdn.com/v4/letter/l/a87d85/32.png) [@Lord\_Rahl](https://forum.kirupa.com/u/Lord_Rahl)\
**Post date:** [May 5, 2005, 11:22am UTC](https://forum.kirupa.com/t/random-integers/89144/1 "2005-05-05T11:22:49Z")

</div>

I have been playing around in flash trying the random code out but I don’t seem to be doing it right.  
What I want to do: Have flash play through and at a certain frame create a random integer (either 1 or 2) and place it in a variable. ThenCheck that variable and if it’s 1 gotoAndPlay(certainframe) and if its 2 gotoAndPlay(anotherframe).  
Here’s what I had tried. On a frame i put

```auto

number=random(2)
if(number=1){
gotoAndPlay(#);
}
if(number=2){
gotoAndPlay(#);
}

```

But, it seemed to always gotoAndPlay the second #. I tried it over 30 times and even had a box showing the variable and no matter what it went to the second frame #. I guess I just don’t know what to put to make this work. Not much work with random scripts so can anyone help me out?
