[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Forwarded mail...




Forwarded message:

> Date: Thu, 29 Oct 1998 00:32:00 +0100
> From: Anonymous <[email protected]>

> In the following snippet of pseudo-code, what should the value of
> SWAP_TIMES be to make the array A[] random, assuming
> that getrand() returned a truly random integer between
> 0 and 255
> 
> A[256];
> 
> for(i=0;i<SWAP_TIMES;i++){
> 	x=getrand();
> 	y=getrand();
> 	swap(A[x],A[y]);
> }

Each x and y is in and of itself random? If so it doesn't matter how often
you swap the elements.

While there are clearly different levels of pseudo-randomness, true
randomness is or isn't.


    ____________________________________________________________________
 
       To know what is right and not to do it is the worst cowardice.

                                                     Confucius

       The Armadillo Group       ,::////;::-.          James Choate
       Austin, Tx               /:'///// ``::>/|/      [email protected]
       www.ssz.com            .',  ||||    `/( e\      512-451-7087
                           -====~~mm-'`-```-mm --'-
    --------------------------------------------------------------------