Re: shuffle or mt_rand

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

 



On Fri, June 29, 2007 4:57 am, Ryan A wrote:
> Have a quick question about which is better to get real random values,
> shuffle or mt_rand.

I *thought* that shuffle used mt_rand under the hood, but could be
totally wrong...

As far as REAL random values goes, that's an encyclopedia of
information, really...

Unless there's real money on the table, shuffle or mt_rand should be
fine.

> 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().

> Any idea which would be better to constantly generate proper random
> numbers for a long period of time?

I'd have to go with Tijnema's code because it will be maintainable
long-term MUCH easier, and I doubt that either is significantly "more"
random than the other.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
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