note 23124 added to function.mt-rand

From: Date: Wed, 10 Jul 2002 10:17:04 +0000
Subject: note 23124 added to function.mt-rand
Groups: php.notes 
Request: Send a blank email to php-notes+get-32827@lists.php.net to get a copy of this message
Sorry, I'm beginer, can some body help me? I use PHP4 I need to generate a numerical row - a numbers from 1 to 100. But (for example, I take a row from 1 to 5): <?php $row[] = (mt_rand(1,5)); $row[] = (mt_rand(1,5)); $row[] = (mt_rand(1,5)); $row[] = (mt_rand(1,5)); $row[] = (mt_rand(1,5)); ?> - is unsatisfactory for me, becouse I need to have a numerical row, in which must be _all_ numbers (1,2,3,4,5 - in our example), _and_ each number must be unique. (In our example- 1,3,5,2,4 - is good; _1_,3,_1_,5,2 - is bad). How to do this? -- http://www.php.net/manual/en/function.mt-rand.php http://master.php.net/manage/user-notes.php?action=edit+23124 http://master.php.net/manage/user-notes.php?action=delete+23124 http://master.php.net/manage/user-notes.php?action=reject+23124

« previous php.notes (#32827) next »