you need the int() since rand returns a decimal, and you were trying to splice out the value of the array index, not the actual index number...for($i=1; $i<=$a; $i++){ $randomelement = int(rand @thumbs); print "<img src=\"$picture_directory/$thumbs[$randomelement]\"> +$picture_directory/$thumbs[$randomelement]<br>"; splice(@thumbs, $randomelement,1); }
In reply to Re: remove a random variable from an array
by suaveant
in thread remove a random variable from an array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |