- var_dump: documentation ( source)
- array_reverse: documentation ( source)
- sort: documentation ( source)
- rand: documentation ( source)
- getrandmax: documentation ( source)
<?php
function random_from_0_to_1()
{
return (float)rand() / (float)getrandmax();
}
$arr = [];
for ($i=0;$i<50;$i++) {
$arr[] = random_from_0_to_1();
}
sort($arr); // sorts ascending
$arr = array_reverse($arr);
var_dump($arr);