Re: Lots of 2s
- From: The Massive Continuity of Ducks <massivecontinuityofducks@xxxxxxxxxxxxx>
- Date: Mon, 25 Feb 2008 20:14:11 +0000
In message <62g0j3F234nqvU1@xxxxxxxxxxxxxxxxxx>, Willy Eckerslyke <oss108no_spam@xxxxxxxxxxxx> writes:
Sam Nelson wrote:
You could try replacing $imageNumber = time() % count($fileList);
with
$imageNumber = rand(0.89)
Or indeed:
$imageNumber = rand(1,(count($fileList)))
If you could be bothered, I'd be tempted to keep track of the images you've already used (just by number, if that's easiest), so that you don't re-use them until you've done them all. That's annoying to do in PHP, as you'd need to pass state back and forth, though easy with a little JavaScript.
Client-side, have an array of all the images you can see. Shuffle the array, go through it one by one with a counter. Timeout with a delay between changes. When you get to the end of the array, shuffle again and put the array counter back to zero. Your PHP could construct the array for the JavaScript code, and drop it into the web page.
I've tended to find that people are happier with this sort of approach than just pure randomness - everything will get seen within a finite (and fairly short) amount of time.
--
The Massive Continuity of Ducks
.
- Follow-Ups:
- Re: Lots of 2s
- From: Willy Eckerslyke
- Re: Lots of 2s
- From: Fevric J Glandules
- Re: Lots of 2s
- From: foghollow
- Re: Lots of 2s
- References:
- Lots of 2s
- From: Fevric J Glandules
- Re: Lots of 2s
- From: Cuban Eel
- Re: Lots of 2s
- From: Willy Eckerslyke
- Re: Lots of 2s
- From: Sam Nelson
- Re: Lots of 2s
- From: Willy Eckerslyke
- Re: Lots of 2s
- From: Sam Nelson
- Re: Lots of 2s
- From: Willy Eckerslyke
- Lots of 2s
- Prev by Date: Re: Lots of 2s
- Next by Date: Re: Lots of 2s
- Previous by thread: Re: Lots of 2s
- Next by thread: Re: Lots of 2s
- Index(es):
Relevant Pages
|