flash actionscript 3 zufallszahl

  • Math.random(), was dir Google nach nicht mal 5 Sekunden mitteilt. Und du musst nicht alles fett schrieben, wir verstehen dich auch so.

    Something big is coming. And there will be pirates and ninjas and unicorns...

  • [h=3]ich ferstehe das es mit Math.random() geht, aber die beispiele die ich angeguck habe sind mir keine große hilfe. es geht nicht um zahlen im bestimmten bereich wie von 0 bis 999999 sondern um 6 stellige Zahlen die so aussehen 000001[/h]

  • Dann setz doch einfach 0er davor? Je nachdem, wie groß die Zahl ist?
    Bei führenden 0ern musst du sowieso das ganze in einen String konvertieren.

    Something big is coming. And there will be pirates and ninjas and unicorns...

  • ich weiß was du meinst:D
    var someNum1:int = Math.floor(Math.random() * 9);
    var someNum2:int = Math.floor(Math.random() * 9);
    var someNum3:int = Math.floor(Math.random() * 9);
    var someNum4:int = Math.floor(Math.random() * 9);
    var someNum5:int = Math.floor(Math.random() * 9);
    var someNum6:int = Math.floor(Math.random() * 9);
    var someNum6:int = Math.floor(Math.random() * 9);
    var ergebnis:= (someNum1 + someNum2 + someNum3+ someNum4 + someNum5 + someNum6);
    Danke! problem gelöst