BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:
In the following runs of the test code below, when
Maybe I'm having a "thick" day today, but for the life of me, I cannot see why?
C:\test>junk0 -K=1e2 K:1e2 L:2 bd => 21537 ux => 27554 su => 32707 db => 10843 fe => 3691 aj => 23335 co => 12919 br => 21357 xw => 15950 hd => 24808 C:\test>junk0 -K=1e3 K:1e3 L:3 ne => 32586 qz => 4931 sp => 30318 tr => 9694 gl => 21489 hn => 6456 xx => 24771 sf => 3369 ro => 27152 pv => 1438 C:\test>junk0 -K=1e4 K:1e4 L:4 alof => 16425 tjtd => 16200 pief => 25920 nlly => 18027 oezy => 19290 eyzv => 5510 ztxl => 11976 yqbz => 8356 hoym => 6193 exid => 29312
The code (run as perl -s scriptname -K=nnn):
#! perl -slw use strict; sub rndStr{ join'', @_[ map{ rand @_ } 1 .. shift ] } sub log10{ log( $_[0] ) / log( 10 ) } our $K ||= 1e3; our $L ||= log10( $K ); print "K:$K L:$L"; my %hash; $hash{ $_ } = int rand 32767 for map{ rndStr( $L, 'a'..'z' ) } 1 .. $K +; print "$_ => $hash{ $_ }" for ( keys %hash )[ 0 .. 9 ];
'Unthick' me please :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: My computer doesn't like the number 3? (Forget it! It's rounding!!!)
by FunkyMonk (Bishop) on Apr 08, 2008 at 17:59 UTC | |
|
Re: My computer doesn't like the number 3? (Forget it! It's rounding!!!)
by ikegami (Patriarch) on Apr 09, 2008 at 00:56 UTC |