<?php
$letters = array('a','b','c','d','e','f','g','h');
$array = array();
// mt_rand used just for filling array, it may be filled manually if neccessary
for ($i=0; $i< 200; ++$i) {
$array[] = $letters[mt_rand(0,count($letters)-1)];
}
for ($i=0; $i< 10000; ++$i) {
echo randTest($array)."<br />";
}
function randTest($array) {
$out = array();
while (count($array) > 0) {
$index = array_rand($array,1);
$out[] = $array[$index];
unset($array[$index]);
}
return implode('', $out);
}
preferences:
30.37 ms | 402 KiB | 5 Q