随机数

Random random = new Random();
Float i = random.nextFloat();
System.out.println((int)(i*1000000));// 815214
Random random = new Random();//默认构造方法
Random random = new Random(1000);//指定种子数字 int i = random.nextInt(100); System.out.println(i);// 87

 

随机字母

(char)(int)(Math.random()*26+97)    // 小写

(char)(int)(Math.random()*26+65)    // 大写

 

相关文章:

  • 2021-07-30
  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2021-11-30
  • 2022-12-23
猜你喜欢
  • 2022-01-24
  • 2021-11-30
  • 2021-07-29
  • 2021-11-30
  • 2021-11-27
  • 2022-12-23
  • 2021-12-16
相关资源
相似解决方案