http://qs1969.pair.com?node_id=557881


in reply to Re^3: Hashes aren't being differently randomized
in thread Hashes aren't being differently randomized

Ever wonder exactly which keys in your particular hash are sharing a bucket? Here is a destructive tool that will tell you that:

my %hash= 0..299; for my $av ( getKeyCollisions( \%hash ) ) { print "@$av\n"; } sub getKeyCollisions { my( $hv )= @_; no warnings 'numeric'; my $buckets= 0 + %$hv; my @keys= keys %$hv; my( @clash, @return ); while( @keys ) { my $key= shift @keys; delete $hv->{$key}; my $b= 0 + %$hv; if( $b == $buckets ) { push @clash, $key; } elsif( @clash ) { push @return, [@clash,$key]; @clash= (); } $buckets= $b; } return @return; } __END__ 276 90 206 118 272 190 298 194 226 58 284 86 76 82 110 280 228 268 218 202 168 184 14 178 24 104 124 256 216 26 80 72 162 74 240 246 108 230 64 210 68 188 116 88 136 30 144 286 120 28 40 134 156 192 250 22 42 158 94 248 296 34 132 164

- tye