Re: [PHP] shuffle or mt_rand

2007-07-02 Thread Richard Lynch
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,

Re: [PHP] shuffle or mt_rand

2007-06-29 Thread Tijnema
On 6/29/07, Ryan A <[EMAIL PROTECTED]> wrote: Just did a quick benchmark for 10.000 hands (making a full deck on your code, 23.5 players): Microtime difference: Ryan's code:15.725826978683 Tijnema's code:0.40006709098816 Unique decks out of 1: Ryan's code:1 Tijnema's code:1 When mak

Re: [PHP] shuffle or mt_rand

2007-06-29 Thread Ryan A
Just did a quick benchmark for 10.000 hands (making a full deck on your code, 23.5 players): Microtime difference: Ryan's code:15.725826978683 Tijnema's code:0.40006709098816 Unique decks out of 1: Ryan's code:1 Tijnema's code:1 When making a full deck my code is 40 times faster, and

Re: [PHP] shuffle or mt_rand

2007-06-29 Thread Fredrik Thunberg
Just did a quick benchmark for 10.000 hands (making a full deck on your code, 23.5 players): Microtime difference: Ryan's code:15.725826978683 Tijnema's code:0.40006709098816 Unique decks out of 1: Ryan's code:1 Tijnema's code:1 When making a full deck my code is 40 times faster

Re: [PHP] shuffle or mt_rand

2007-06-29 Thread Tijnema
On 6/29/07, Ryan A <[EMAIL PROTECTED]> 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

Re: [PHP] shuffle or mt_rand

2007-06-29 Thread Richard Heyes
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 bett

[PHP] shuffle or mt_rand

2007-06-29 Thread Ryan A
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().

Re: [PHP] shuffle

2004-07-14 Thread Curt Zirzow
* Thus wrote Edward Peloke: > it is strange... > > if I do this: > > function nextRecord(){ > $this->[EMAIL PROTECTED]($this->queryID); Don't use the @ sign, it is bad practice. > $test=$this->record; > echo $test; I'm not sure what this is for. > > $status=is_array($this->record); > return

RE: [PHP] shuffle

2004-07-14 Thread Edward Peloke
I didn't try that but it works great...thanks! -Original Message- From: Torsten Roehr [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 14, 2004 3:53 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] shuffle "Edward Peloke" <[EMAIL PROTECTED]> wrote in message news:[EMA

Re: [PHP] shuffle

2004-07-14 Thread Torsten Roehr
"Edward Peloke" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > it is strange... > > if I do this: > > function nextRecord(){ > $this->[EMAIL PROTECTED]($this->queryID); > $test=$this->record; > echo $test; > > $status=is_array($this->record); > return ($status); > } > > "Array" is ec

RE: [PHP] shuffle

2004-07-14 Thread Edward Peloke
I get the warning that shuffle() expects parameter 1 to be an array, boolean given. -Original Message- From: Edward Peloke [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 14, 2004 2:23 PM To: Php-General Subject: [PHP] shuffle I am using a db class which has the following method f

[PHP] shuffle

2004-07-14 Thread Edward Peloke
I am using a db class which has the following method for cycling through the records function nextRecord(){ $this->[EMAIL PROTECTED]($this->queryID); $status=is_array($this->Record); return ($status); } where queryID is set by running the query. It works fine and I can run it as follows $sql->q

[PHP] Shuffle Cards Function

2001-08-18 Thread Robert Schultz
I've written a ShuffleCards function that will actually shuffle a deck of cards just like would happen in real life (divide the deck in half and stick them into each other with 1-3 cards between each other card) function ShuffleCards(&$cardsArray, $times) { // Randomizes where to split