in reply to Reading files sequentially
However since you are doing a website, you may not want the same two ads to always appear next to each other. Therefore, I would do the following:
1. Read all the images in from the file
2. Shuffle the array
3. Pop one image off the end of the array
4. Repeat (3) until array is empty, then goto (1)
Check out (ar0n: Algorithm::Numerical::Shuffle) Re: Randomize an array and Answer: How do I shuffle an array? for code on how to shuffle an array.
Cheers,
Gryn
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Random and sequential for the price of one!
by damian (Beadle) on Sep 15, 2000 at 07:09 UTC | |
by gryng (Hermit) on Sep 15, 2000 at 07:36 UTC | |
by damian (Beadle) on Sep 15, 2000 at 08:05 UTC | |
by gryng (Hermit) on Sep 15, 2000 at 08:40 UTC | |
by damian (Beadle) on Sep 15, 2000 at 09:09 UTC | |
by tilly (Archbishop) on Sep 15, 2000 at 12:47 UTC |