note 35138 added to function.rand
| From: | php-general at lists dot php dot net | Date: | Thu, 21 Aug 2003 00:43:01 +0000 |
| Subject: | note 35138 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-54788@lists.php.net to get a copy of this message | ||
Well I wanted to suggest a feature - but the "request a feature" link goes to the BUG
page.. DOH!
anyways, rand() should take 4 arguments..
array = rand(int min, int max[, int num_req] [, int allow duplicates])
where you would have something like..
$array = rand(0,100,5,1)
and you could get 5 random values with no duplicates..
$array[0] = 10;
$array[1] = 35;
etc...
or you could do..
$array = rand(0,100,5)
and get 5 random values with duplicates possible..
$array[0] = 10;
$array[1] = 35;
$array[2] = 10;
etc..
and of course just like when you use array_rand() if you do not provide the 3rd argument or the 3rd
argument is valued at 1, the value is just a single int.. else its an array..
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35138
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35138&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35138&report=yes