|
Posted by boclair on 07/18/06 04:52
AP wrote:
> Hello
> Any suggestions on the most efficient way to generate a random number
> from a range that will not return values specified in an array?
>
No doubt better methods but a quick thought
$fulllist = range(1, 12);
shuffle($fulllist);
$vetolist = array (2,3,7,8);
$alive = array_diff($fulllist, $vetolist);
foreach ($alive as $value) {
echo "$value, ";
}
Louise
Navigation:
[Reply to this message]
|