#!/usr/local/bin/perl -w %hash=(); for (;;){ @a=(0,1,2,2,2,2,2,2,4,4); $x = splice @a, int rand(@a), 1; $y = splice @a, int rand(@a), 1; $z = splice @a, int rand(@a), 1; $q = splice @a, int rand(@a), 1; $num = $x.$y.$z.$q; if (length($num) !=4) { warn "Program corrupted"; } # if ($x!=0){ $hash{$num}++; if ($hash{$num}==1){ $counter++; } # } last if (++$it>10_000_000); print "\r$it"; } print "\n$counter\n"; for $i (sort keys %hash){ print "$i "; } print "\n"; __END__ From p.ralston@comcast.net Fri Oct 8 20:07:21 2004 Date: Fri, 8 Oct 2004 18:07:21 +0000 (UTC) From: Peter Ralston