JavaScript Math

Math.floor(Math.random() * 10) returns a random integer between 0 and 9 (both included):