Einzelnen Beitrag anzeigen
  #3 (permalink)  
Alt 24-03-2006, 11:01
jahlives
 Master
Links : Onlinestatus : jahlives ist offline
Registriert seit: Jun 2004
Ort: Hooker in Kernel
Beiträge: 8.283
jahlives ist zur Zeit noch ein unbeschriebenes Blatt
Standard

PHP-Code:
$temp = array();
$i 0;
while(
$i<6){
    
$zahl1 rand(1,100);
    while(
in_array($temp,$zahl1)){
        
$zahl1 rand(1,100);
    }
    
$temp[] = $zahl1;
    
$i += 1;

Bin gerade erst aufgestanden, sollte aber so funzen Die äussere Schleife ist für deine 6 Zahlen zuständig und die innere wird solange durchlaufen, bis die Zufallszahl nicht im Array existiert...

Gruss

tobi
__________________
Gutes Tutorial | PHP Manual | MySql Manual | PHP FAQ | Apache | Suchfunktion für eigene Seiten

"An error does not become truth by reason of multiplied propagation, nor does truth become error because nobody sees it."
Mohandas Karamchand Gandhi (Mahatma Gandhi) (Source)
Mit Zitat antworten