[ the code for a course follows the convention category.id.level.sessions and uniquely identifies a course ]
lecture code viewer
downloads
Code
Generating Randomness
Generating Randomness
Martin Krzywinski
#!/usr/local/bin/perl -w
use strict;
use lib "/home/martink/export/extern/perl/lib/site_perl/5.005";
use Time::HiRes qw(gettimeofday tv_interval);
use Math::Random;
use Statistics::ChiSquare;
use Math::Random::MT;
$\="\n";
$,=" ";
my $t;
my $N = 1000000;
random_set_seed_from_phrase("asdlkjasdfo2394852");
my $mt = Math::Random::MT->new(time);
$t = [gettimeofday];
my @mtr;
for(0..$N-1) {
$mtr [ 30 * $mt->rand() ] ++;
}
print int($N/tv_interval($t)),"MT values per second",chisquare(@mtr);
random_set_seed_from_phrase("asdlkjasdfo2394852");
$t = [gettimeofday];
my @rlr;
for(0..$N-1) {
$rlr[ 30 * random_uniform ] ++;
}
print int($N/tv_interval($t)),"randlib values per second",chisquare(@rlr);
$t = [gettimeofday];
my @rr;
for(0..$N-1) {
$rr[ 30 * rand ]++;
}
print int($N/tv_interval($t)),"rand() values per second",chisquare(@rr);
|
1 |
Generating Randomness |
4.1.2.2.1
4.1.2.2.1.c1 |
brownnoise.wav
|
Martin Krzywinski
|
code
4.1.2.2.1.c2 |
devrandom
|
Martin Krzywinski
|
code
4.1.2.2.1.c3 |
drophaltonrice
|
Martin Krzywinski
|
code
4.1.2.2.1.c4 |
droprice
|
Martin Krzywinski
|
code
4.1.2.2.1.c5 |
halton
|
Martin Krzywinski
|
code
4.1.2.2.1.c6 |
halton.11.13.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c7 |
halton.3.5.1000.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c8 |
halton.3.5.10000.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c9 |
halton.3.5.200.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c10 |
halton.3.5.2000.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c11 |
halton.3.5.400.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c12 |
halton.3.5.4000.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c13 |
halton.3.5.600.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c14 |
halton.3.5.800.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c15 |
halton.3.5.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c16 |
halton.5.7.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c17 |
halton.7.17.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c18 |
halton.new.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c19 |
haltonrice.diff.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c20 |
haltonrice.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c21 |
pinknoise.wav
|
Martin Krzywinski
|
code
4.1.2.2.1.c22 |
prng
|
Martin Krzywinski
|
code
4.1.2.2.1.c23 |
prng.1.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c24 |
prng.2.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c25 |
prng.3.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c26 |
randbase
|
Martin Krzywinski
|
code
4.1.2.2.1.c27 |
randrice.diff.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c28 |
randrice.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c29 |
randstring
|
Martin Krzywinski
|
code
4.1.2.2.1.c30 |
randtests
|
Martin Krzywinski
|
code
4.1.2.2.1.c31 |
rice.diff.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c32 |
rice.results.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c33 |
rice.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c34 |
rice.value.txt
|
Martin Krzywinski
|
code
4.1.2.2.1.c35 |
shake
|
Martin Krzywinski
|
code
4.1.2.2.1.c36 |
trulyrandom
|
Martin Krzywinski
|
code
4.1.2.2.1.c37 |
whitenoise.wav
|
Martin Krzywinski
|
code
4.1.2.2.1.a1 |
Generating Randomness
|
Martin Krzywinski
|
pdf
4.1.2.2.1.p1 |
Generating Randomness
|
Martin Krzywinski
|
ppt
4.1.2.2.1.s1 |
Generating Randomness
|
Martin Krzywinski
|
slides
|