If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Display sequence of numbers in random order

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-02-04, 10:01
kmcgillivray kmcgillivray is offline
Registered User
 
Join Date: Jul 2003
Posts: 6
Display sequence of numbers in random order

Does anyone know of an elegant way to take a series of numbers and display them in a random order where each number is displayed only once?

I suppose I could generate a random number and check to see if it has been displayed already but that seems clunky and there's no way to predict how long it would take to display the whole series.

I had also thought about adding all 20 numbers to an array, picking a random position in the array and displaying it, then removing that position from the array and picking a random position from the remaining 19 and so on until I've displayed all 20 numbers.

Any suggestions?
Reply With Quote
  #2 (permalink)  
Old 11-02-04, 17:18
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
The second option sounds better but you have to keep redimensioning your array which can be a pain in the arse.

Do you display them all at once or do you display one on each page hit??
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On