Re: random numbers
Posted: Mon Apr 26, 2010 1:49 pm
Actually the first one results in a parse error. I'm not sure they guarantee unique numbers either.
This was the direction I was headed, but it of course does not work because shuffle doesn't return anything useful.
This should work ok:
Maybe using a combination of array_map and array_rand would result in a good one liner.
This was the direction I was headed, but it of course does not work because shuffle doesn't return anything useful.
Code: Select all
$random = array_slice(shuffle(range(0, 25000)), 0, 103);Code: Select all
$pool = range(0,25000);
shuffle($pool);
$random = array_slice($pool, 0, 103);