H. Peter Anvin <hpa@[EMAIL PROTECTED]
> wrote in part:
> Well, there are a few different problems:
>
> a. 52 out of 52 cards;
> b. 5 out of 52 cards;
> c. 5 out of 5 cards.
>
> I described (a), pretty much.
>
> (b) uses the same algorithm as (a), you just stop after
> 5 iterations instead of 52.
Except if the order of the 5 doesn't matter, that algorithm
should be a random draw. This is one way to do card.sims:
draw truly random 52*rand() but track cards already drawn (4
16bit words if space is short) and redraw repeats. Works fine
(few redraws) until the decks get short, which few games allow.
-- Robert


|