Q:

shuffle() array.. correct way to randomize array results?

I am wondering if the shuffle() array function is the correct way to randomize array results.
Basically, I have some ad codes in an array, and I use this to display 1 random ad each time, but there is an ad that seems to appear much much more than anything! I mean out of 20 times it appeared about 18 times. I'd thought by randomizing the results I'd get around equal views for each ad but thats not the case.
It makes me question here. Is shuffle the correct way to do this.. or do I need something totally different?
Here is my code to grab the random ad code at a time.
if (count($eligible_ads) > 1) {
    shuffle($eligible_ads);
    echo stripslashes($eligible_ads[0]['code']);
}

A:

You could also simply pick a random key using array_rand, instead of shuffling the whole thing. It won't get any more random than that*. You can't say something's not random with test data based on only 20 runs. It should even out if you run it a few thousand more times.
In other words:

* As far as PRNGs go at least.

