Re: VERY URGENT C PROGRAM



Keith Thompson wrote:
"William J. Leary Jr." <Bill_Leary@xxxxxxx> writes:

.... snip ...

I implemented this thing for a deck of cards in C (almost on topic!)
some years ago. Well, a lot of years ago now that I think of is,
since I ran it on a VAX. I had it run in the background (UNIX) and
keep count of how many times it had to "toss" before getting a
result. Over a couple of weeks it ran anywhere from ten passes to
many many thousands. One run didn't terminate after several days.
I had to kill it.

How big was the deck? If it was a standard 52-card deck, I'd be
astonished if it *ever* sorted; there are 52!, or about 8e67,
permutations. (That's 8 * 10**67, not 0x8E67.)

The quality of the PRNG has something to do with the results. I
don't believe there is any such that can guarantee a sort in this
case. So you need an external truly random mechanism.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>


.



Relevant Pages

  • Re: variable might not have been initialized
    ... No skin off my nose. ... > print out all the cards in a deck. ...
    (comp.lang.java.programmer)
  • Re: crit. revised opening.
    ... I'm currently re-reading the Belgariad and the Malloreon ... Belgarion and Silk are on the deck of a ship. ... still leaning on the rail several yards away. ...
    (rec.arts.sf.composition)
  • Re: hot house, dinner tonight
    ... > ~out on the porch or the deck. ... bread machine in the summertime, I bring them out to the patio. ...
    (rec.food.cooking)
  • Re: low tech encryption, solitaire
    ... > I've determined that there is no bias in the output characters, ... By using a double deck you would be able to get a letter as many as four ...
    (sci.crypt)
  • Re: (Event) Beware the Ides of March - results
    ... Most Wanted Pre-Release 2005) I was ready to jump back in and start ... anew. ... But the deck did pretty well. ...
    (rec.games.trading-cards.jyhad)