|
Posted by floortje on 09/27/57 12:00
Fred Atkinson wrote:
> I've written a PHP script that randomly selects a sound file
> to play for the BGSOUND tag.
....
> The problem is that when I test it, it seems to favor the
> first and the last sound file and rarely plays the second one.
Are you sure ??
> Is there a better way to make the random number selection more
> evenly distributed?
$array = array("sound_1.wav","sound_2.wav","sound_3.wav");
echo '<bgsound src="'.$array[floor(rand(0,(count($array)*100))/100)].'">';
Arjen
Navigation:
[Reply to this message]
|