# Random Nunber without repeating

**URL:** <https://forum.kirupa.com/t/random-nunber-without-repeating/330081>\
**Category:** flash\
**Created:** [November 27, 2012, 9:55am UTC](https://forum.kirupa.com/t/random-nunber-without-repeating/330081 "2012-11-27T09:55:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hsiehson](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@hsiehson](https://forum.kirupa.com/u/hsiehson)\
**Post date:** [November 27, 2012, 9:55am UTC](https://forum.kirupa.com/t/random-nunber-without-repeating/330081/1 "2012-11-27T09:55:38Z")

</div>

Hi all,  
Thanks for visiting my post.

I am creating a learning swf which the person press a button that will generate a random question, with visual aids in associate to it (in my case, its a picture with sound).  
Because I later need to import it into Indesign, which I think has problem getting external media from imported swfs,

So, what I have done is put my media into stream format, and lay them flat out on the timeline with frames. Than put a butten that consists of the following code…

```auto

on (release) {
myrandomnumber=int(Math.random()*3+1);
if(myrandomnumber== 1)
{gotoAndPlay("s1");}
else if(myrandomnumber== 2)
{gotoAndPlay("s2");}
else if(myrandomnumber== 3)
{gotoAndPlay("s3");}
}

```

It did randomly give me questions, but I don’t know how to make it random without repeating questions that has been asked.

Appreciate any support, thanks!
