Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Flash - ActionScript

Choosing serveral random and unique numbers

 
Jump to:  
 
jjulie
PostPosted: Tue Jul 29, 2008 5:31 pm    Post subject: Choosing serveral random and unique numbers
       
Hi

I'd like to select 9 random numbers out of a set of let's say 1-20. They can't repeat and each has to be saved into a different variable P1-P9.

Any ideas?
Thanks
 

 
Rothrock
PostPosted: Tue Jul 29, 2008 6:48 pm    Post subject: Re: Choosing serveral random and unique numbers
       
Make an array of the numbers 1 through 20.
Shuffle the array.
Take off as many numbers as you need.

Search the forums for shuffle to find out how to shuffle the array.
 

 
jjulie
PostPosted: Tue Jul 29, 2008 7:05 pm    Post subject: Re: Choosing serveral random and unique numbers
       
Thanks Rothrock, I had just figured that out too.
Sometimes it's that easy... Wink
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

wynajem warszawa Rapidshare park monitoring wizyjny Fotka