Hash limits? (Was: Re: rand() not so random)

2005-12-01 Thread Ted Schuerzinger
[EMAIL PROTECTED] (Chris Wagner) graced perl with these words of wisdom: Just for fun I did a little test. for (1 .. 1) { my $fn = rand(); ++$dup and next if exists $num{$fn}; $num{$fn} = 1; } print scalar keys %num, unique numbers. $dup duplicates produced\n;

Re: Hash limits? (Was: Re: rand() not so random)

2005-12-01 Thread Chris Wagner
At 10:53 AM 12/1/2005 -0500, Ted Schuerzinger wrote: Just for fun, I changed one of the lines in that to for (1 .. 100) { When I ran the modified script, I got 32768 unique numbers, with 967232 duplicates! As 32768 is a power of 2, I'm wondering if there's a limit on the number of keys

Re: Hash limits? (Was: Re: rand() not so random)

2005-12-01 Thread Chris Wagner
Wait, I screwed up that last email. The uniques is the number of hash keys. At 10:53 AM 12/1/2005 -0500, Ted Schuerzinger wrote: for (1 .. 1) { my $fn = rand(); ++$dup and next if exists $num{$fn}; $num{$fn} = 1; } print scalar keys %num, unique numbers. $dup

Re: Hash limits? (Was: Re: rand() not so random)

2005-12-01 Thread Eric Amick
On Thu, 1 Dec 2005 12:05:11 -0800, you wrote: [EMAIL PROTECTED] (Chris Wagner) graced perl with these words of wisdom: Just for fun I did a little test. for (1 .. 1) { my $fn = rand(); ++$dup and next if exists $num{$fn}; $num{$fn} = 1; } print scalar keys %num,

Re: Hash limits? (Was: Re: rand() not so random)

2005-12-01 Thread Sisyphus
- Original Message - From: Ted Schuerzinger [EMAIL PROTECTED] To: Perl-Win32-Users@listserv.ActiveState.com Sent: Friday, December 02, 2005 2:53 AM Subject: Hash limits? (Was: Re: rand() not so random) [EMAIL PROTECTED] (Chris Wagner) graced perl with these words of wisdom: Just

RE: Hash limits? (Was: Re: rand() not so random)

2005-12-01 Thread Jan Dubois
On Thu, 01 Dec 2005, Ted Schuerzinger wrote: Just for fun I did a little test. for (1 .. 1) { my $fn = rand(); ++$dup and next if exists $num{$fn}; $num{$fn} = 1; } print scalar keys %num, unique numbers. $dup duplicates produced\n; Just for fun, I changed