note 35138 deleted from function.rand by rioter

From: Date: Thu, 21 Aug 2003 01:02:12 +0000
Subject: note 35138 deleted from function.rand by rioter
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-54789@lists.php.net to get a copy of this message
Note Submitter: ---- 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..

« previous php.notes (#54789) next »