如何随机的选择数据,我的目标想做随机点名小程序
package DailyHomework; import java.util.Random;//包含随机数需要的类 public class Homework10 { private static final int ramNum = 2; public static void main(String args[]){ String [] nameList= {"张三","李四","王五"}; int rdmNum=(int)(Math.random()*nameList.length); System.out.println(nameList[ramNum]); } }