- or download this
-- To shuffle an array a of n elements (indices 0..n-1):
for i from 0 to n-2 do
j <- random integer such that i <= j < n
exchange a[i] and a[j]
- or download this
$n = scalar(@aliased);
$a = $_ + rand @aliased - $_ # original code
...
= random integer such that i <= j <= i+$n-i-1
= random integer such that i <= j <= $n-1
= random integer such that i <= j < $n
- or download this
for 0 .. $#aliased {
$a = $_ + rand @aliased - $_;
...
$aliased[ $_ ] = $aliased[ $a ],
$aliased[ $a ] = $b
}
- or download this
for i from 0 to n-1 do
j <- random integer such that i <= j < n
exchange a[i] and a[j]
- or download this
#!/usr/bin/env perl
...
my ($a, $b) = @_;
return 100 - 100 * $a / $b
}
- or download this
#!/usr/bin/env perl
...
my ($a, $b) = @_;
return 100 - 100 * $a / $b
}
- or download this
#!/usr/bin/env perl
...
my ($a, $b) = @_;
return 100 - 100 * $a / $b
}
- or download this
./random_walk_test.pl : done 10000000 trials with 10 bins, here is a s
+ummary:
./random_walk_test.pl : RandomWalk test : Math::Random::MT's rand() wi
+th mean %diff from expected to be 0.022 %
...
./transition_matrix_test.pl : best results for transition matrix test
+: Perl's rand() with mean %diff from expected count to be 1.796 %
./transition_matrix_test.pl : end.