Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Testing for randomness

by zakzebrowski (Curate)
on Oct 23, 2003 at 15:51 UTC ( #301619=note: print w/replies, xml ) Need Help??

in reply to Testing for randomness

If you're looking for a non-scientific but warm fuzzy approach, I would generate about, oh, 100 files with n runs, with each character representing 8 runs. (So you get an ascii character). Then, I would make a copy of the file and gzip it. Compare the sizes of the orignal and new file, and the better job the compression does, the less randomness it is... (This approach was sort of discussed a long time ago in perl monks about checking for randomness of passwords...)

undef$/;$mmm="J\nutsu\nutss\nuts\nutst\nuts A\nutsn\nutso\nutst\nutsh\ +nutse\nutsr\nuts P\nutse\nutsr\nutsl\nuts H\nutsa\nutsc\nutsk\nutse\n +utsr\nuts";open($DOH,"<",\$mmm);$_=$forbbiden=<$DOH>;s/\nuts//g;print +;

Replies are listed 'Best First'.
Re: Re: Testing for randomness
by Anonymous Monk on Oct 23, 2003 at 15:57 UTC
    This is not a great idea. It's perfectly possible to have highly non-random data that produce worst-case performance in a given compression algorithm. You'd be better off with statistical tests (i.e. chi square).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://301619]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2020-07-06 03:12 GMT
Find Nodes?
    Voting Booth?

    No recent polls found