Kartenspiel, aber was macht das?
#!/usr/bin/perl
for (
$C = 3636, $c = 0, $i = 0 $t = 0;
$i < 1000 ;
$i++, $n = int( rand(6) )*2
)
{
next if ( ( ( $C >> $n ) & 2 ) == 0 );
++$t;
++$c if ( ( ( $C >> $n ) & 3 ) == 3 );
}
print $c / ( 0.01 * $t ) . "%n";
oder auch:
@t=grep{++$n;$_&1}grep$_&2,map 111>>(2*int rand 6),(0..999);$p=100*$#t/$n;print"$p%n";