Re: shuffle or mt_rand

From: Date: Fri, 29 Jun 2007 10:13:44 +0000
Subject: Re: shuffle or mt_rand
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-257950@lists.php.net to get a copy of this message
Ryan A wrote:
Hey, Have a quick question about which is better to get real random values, shuffle or mt_rand. I am trying to shuffle a deck of cards and reading another thread I saw that after a couple of thousand random generations patterns have been observed using rand()... so its better to use mt_rand().
Well they do different things - shuffle() randomises an array, whereas mt_rand() gives you a random number. If you want to randomise an array, use shuffle(). If you want a random number, use mt_rand(). -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software

« previous php.general (#257950) next »