var a = Math.random() + ""
var rand1 = a.charAt(5)
secondo me è meglio un ceil(Math.random()*9)