Hallo,
var i= Math.floor(Math.random() * 3) + 1;
Hmm, etz kommt aber die 4 gar nicht mehr, oder?
Math.random liefert doch zwischen 0 und 1, Math.floor die nächst-niedrige-Zahl, also sei (1 - Math.random) nahe Null, also z.B.:
Marth.random() = 0.99857
Dann ist Math.floor(Math.random)+1 = Math.floor(2.9957)+1 = 2+1 = 3;
wäre besser.
Sicher? ;)
Jörg