note 14727 deleted from function.array-rand by aidan
| From: | aidan@php.net | Date: | Sat, 28 Aug 2004 03:57:24 +0000 |
| Subject: | note 14727 deleted from function.array-rand by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75485@lists.php.net to get a copy of this message | ||
Note Submitter: alex at absolute dot lv
----
For php3 I think it'll be much easer to use:
srand ((double) microtime() * 10000000);
$ph2=0;
$from_num=0; //from what number need rand
$till_num=20; //till what number need rand
$how_much=5; //how much different numbers you need
while ($ph2<=$how_much){
$randval[$ph2] = rand($from_num,$till_num);
$check=0;
for ($x=1; $x<$ph2; $x++){
if ($randval[$ph2] == $randval[$x]) {$check=1;};
};
if ($check==0){$ph2++;};
};
for ($x=0; $x<=$how_much; $x++){
echo $randval[$x]; //on screen
};