Re: [PHP] shuffle or mt_rand





<snip>

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 10000:
Ryan's code:10000
Tijnema's code:10000

When making a full deck my code is 40 times faster, and a lot less
memory intensive. And as you can see, for both all 10000 decks are
unique, so both are random :)

But, also when generating cards for only 4 players, my code is twice
as fast as yours, and both generate still 10000 random decks:

Microtime difference:
Ryan's code:0.82403707504272
Tijnema's code:0.40426802635193

Unique decks out of 10000:
Ryan's code:10000
Tijnema's code:10000


Tijnema


Just a pointer:

Just because you get 10000 different decks doesn't mean that it is random.

Since there are 52! (around 8*10^67) different decks and you choose 10000 of theese you would be very lucky to get 2 that are the same.
--
/Thunis

"I refuse to answer that question on the grounds that I don't know the answer."
--The Hitchikers Guide to the Galaxy
.



Relevant Pages

  • Re: [PHP] shuffle or mt_rand
    ... Microtime difference: ... Unique decks out of 10000: ... But, also when generating cards for only 4 players, my code is twice ...
    (php.general)
  • Re: Imbued & Powers?
    ... And, yes, that happens in other decks sometimes too, but not ... combat - as opposed to the plethora of ways to destroy vampires. ... and Gehenna light (sorry no chance of NO gehenna imbued decks - Edge ... Yet some players still play ...
    (rec.games.trading-cards.jyhad)
  • Australian Nationals Report
    ... So I am reporting on the nationals first instead of the LCQ first ... This year saw 27 players appear out of the shadows ... Decks were quite interesting to see. ... Just to state the seating order: Jason Ryan -> James Floate ...
    (rec.games.trading-cards.jyhad)
  • Re: Australian Nationals Report
    ... The day began like any other luke warm day in Blacktown. ... This year saw 27 players appear out of the shadows ... Decks were quite interesting to see. ... Just to state the seating order: Jason Ryan -> James Floate ...
    (rec.games.trading-cards.jyhad)
  • Re: Imbued & Powers?
    ... And, yes, that happens in other decks sometimes too, but not ... combat - as opposed to the plethora of ways to destroy vampires. ... you generally get two types of Imbued decks - Gehenna heavy ... Yet some players still play ...
    (rec.games.trading-cards.jyhad)