function myRand ():Number { var rand:Number = Math.ceil(Math.random() * 29); return rand; } //искомое число num = myRand ();