<html> <body bgcolor="#C0C0C0"><font size ="6" color="#ff0000"> Es werden 6 Zahlen aus 49 zufällig gewählt (mit F5 werden diese neu geladen), ohne Zurücklegen (Lotto).<br> Die Zahlen lauten:<br> <?php // n = Anzahl Züge, m=größte natürliche Zahl in Urne $n=6; $m=49; $a=array(); srand(microtime()*1000000); $x=rand(1,$m); $a[1]=$x; for($i=2;$i<=$n;$i++){ while(in_array($x,$a)) {srand(microtime()*1000000); $x=rand(1,$m);} $a[$i]=$x;} // Ausgabe for($i=1;$i<=$n;$i++){echo $a[$i].", ";} ?> </font> </body></html> |