生成指定范围指定大小的随机数:
1 String code = String.valueOf((int)(Math.random()*(9999-1000+1))).substring(0,4);
生成指定范围指定大小的随机数:
1 String code = String.valueOf((int)(Math.random()*(9999-1000+1))).substring(0,4);
转载于:https://www.cnblogs.com/find-the-right-direction/p/8432700.html