Re: shuffle or mt_rand

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux