PHP/Data Structure/shuffle
Randomizing an Array Using shuffle(), kshuffle(), and array_rand()
<?php
$nums = array(15, 2.2, -4, 2.3, 0);
shuffle($nums);
printf("<pre>%s</pre>\n", var_export($nums, TRUE));
shuffle($nums);
printf("<pre>%s</pre>\n", var_export($nums, TRUE));
shuffle($nums);
printf("<pre>%s</pre>\n", var_export($nums, TRUE));
?>
shuffle( ) function randomizes the position of the elements
<?
$natural_born_killers = array("lions", "tigers", "bears", "kittens");
shuffle($natural_born_killers);
?>
shuffle.php
<?php
$cards = array("a","b","c","d","e","f","g","h");
shuffle($cards);
print_r($positions);
?>