If you used 'Greenfoot.getRandomNumber(4)', you will get a number in the set { 0, 1, 2, 3 }. Adding one to the result will get you a number between 1 and 4. If you are turning by 't*90' degrees and a turn must be executed then you must remember that '4*90 = 360' and no turn will be exacted (the actor will look in the same direction as before)..