# Sequence of numbers - Macromedia Flash

Hi Anyones knows how to make a random sequence of the numbers 1-13, without having the numbers to repeat themselve. I have tried this: numre = new Array(); Randomize; for (i=0; i<13; i++) { numre[i] = random(13); } But that will give me repetitions of same numbers...!! And randomize does not seem to work in flash 5...

1. ## Sequence of numbers

Hi

Anyones knows how to make a random sequence of the numbers 1-13,
without having the numbers to repeat themselve.

I have tried this:

numre = new Array();
Randomize;
for (i=0; i<13; i++) {
numre[i] = random(13);
}

But that will give me repetitions of same numbers...!!

And randomize does not seem to work in flash 5
S?ren Nielsen Guest

2. ## Re: Sequence of numbers

S?ren Nielsen wrote:
> Anyones knows how to make a random sequence of the numbers 1-13,
> without having the numbers to repeat themselve.
> numre = new Array();
> Randomize;
> for (i=0; i<13; i++) {
> numre[i] = random(13);
> }
//Make array
arr = new Array();
for(i=1;i<=13;++i){
arr[i-1] = i;
}

//Randomize array
for(i=0;i<13;++i){
newnum = Math.round(Math.random()*12);
if (newnum == i)
continue;
tmp = arr[newnum];
arr.splice(newnum,1,arr[i]);
arr[i] = tmp;
}

Shawn
--
Shawn Wilson
[email]shawnglassgiant.com[/email]
[url]http://www.glassgiant.com[/url]
Shawn Wilson Guest

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•