C语言教程数组随机取值的使用
C语言教程数组随机取值的使用 function load(minnum,maxnum){ var choice = maxnum - minnum + 1; var a = Math.floor(Math.random()*choice + minnum); return a; } var groups = ['0','1','2','3','4']; var b = groups[load(0,groups.length - 1)]; alert(b);