Talk About Network

Google





Programming > Assembly Language > Re: I pee in th...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 19 of 20 Topic 5075 of 5194
Post > Topic >>

Re: I pee in the open

by Robert Redelmeier <redelm@[EMAIL PROTECTED] > Jul 23, 2008 at 06:21 PM

Rod Pemberton <do_not_have@[EMAIL PROTECTED]
> wrote in part:
> :-)  Thank you.  Did you look at it enough to understand how it cuts the
> deck with an inexact cut without under/overflow from each half of the
deck?

iAs this is ALA, I plead the 5th:  I refuse to confess any fluency in C 
:)

> First, human shuffling isn't random.  

Agreed.  But humans also don't start with a new ordered deck
of cards for each hand.  The gathering of played cards and
reshuffling adds entropy.

> Second, rand() is usually implemented as pseudo-random number generator
> (PRNG).  So, there's no way (AFAIK) to get random results from it no
matter
> how you use it.  From plots I've seen, it seems the first, second, third
> order combinations of typical rand() values are still non-random.  So,
you

You can sometimes do better than others.  Knuth has quite a
bit on this.

>     Edition, Addison-Wesley, 1998, p. 106 (line 26) & p. 108 */
>  next = next * 6364136223846793005LL + 1;
>  /* was: next = next * 0x5deece66dLL + 11; */
>  return (int)((next >> 21) & RAND_MAX);

A very standard linear-congruent PRNG.

> The compilers doc's recommended losing the lower bits of it's
> rand() function - too static.

And the upper bits aren't too great either.  This is where RAND_MAX
has to be well-chosen.


> And, since the results didn't look quite natural on my
> machine with rand(), I randomized the range also on the
> flutter (i.e, two rand()'s).  With the dual rand()'s, output
> looked from my compiler looked slightly more natural to me
> after three shuffles.

Looks are very deceiving.  There are specific tests (Chi square IIRC),
and good-quality randomness is necessary for machines moreso than
humans since there usually are many more trials for any non-random
bias to exert itself.


-- Robert
 




 20 Posts in Topic:
Re: I pee in the open
"Alexei A. Frounze&q  2008-07-14 01:15:57 
Re: I pee in the open
"Rod Pemberton"  2008-07-14 05:39:09 
Re: I pee in the open
"Wolfgang Kern"  2008-07-14 13:18:06 
Re: I pee in the open
"H. Peter Anvin"  2008-07-14 13:03:34 
Re: I pee in the open
"Wolfgang Kern"  2008-07-14 22:50:38 
Re: I pee in the open
Phil Carmody <thefatph  2008-07-15 03:25:24 
Re: I pee in the open
"Rod Pemberton"  2008-07-15 05:01:34 
Re: I pee in the open
"Wolfgang Kern"  2008-07-15 11:43:35 
Re: I pee in the open
"Rod Pemberton"  2008-07-15 08:39:19 
Re: I pee in the open
"Wolfgang Kern"  2008-07-15 18:56:35 
Re: I pee in the open
"H. Peter Anvin"  2008-07-18 14:07:16 
Re: I pee in the open
"Rod Pemberton"  2008-07-19 04:13:29 
Re: I pee in the open
"H. Peter Anvin"  2008-07-19 19:18:14 
Re: I pee in the open
"Rod Pemberton"  2008-07-20 14:45:57 
Re: I pee in the open
Robert Redelmeier <red  2008-07-21 03:01:16 
Re: I pee in the open
"Rod Pemberton"  2008-07-21 04:18:57 
Re: I pee in the open
Robert Redelmeier <red  2008-07-22 23:14:35 
Re: I pee in the open
"Rod Pemberton"  2008-07-22 22:31:27 
Re: I pee in the open
Robert Redelmeier <red  2008-07-23 18:21:47 
Re: I pee in the open
"Rod Pemberton"  2008-07-23 18:41:21 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 17:57:33 PST 2009.