|  | Choosing serveral random and unique numbers |  | |
| | | jjulie |  |
| Posted: 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 |  |
| Posted: 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 |  |
| Posted: 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...  |
| |
|
|