note 59510 deleted from function.rand by nlopess

From: Date: Sat, 21 Jan 2006 11:27:23 +0000
Subject: note 59510 deleted from function.rand by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-102204@lists.php.net to get a copy of this message
Note Submitter: amishmithani at hotmail dot com ---- To get unique values from rand, use the following recursive function. function returnRand($patternArray){ $var = rand(1,15); if(in_array($var,$patternArray)){ return returnRand($patternArray); }else{ return $var; } } for($a=0; $a < 4; $a++){ $pattern[] = returnRand($pattern); }

« previous php.notes (#102204) next »