zl程序教程

您现在的位置是:首页 >  其它

当前栏目

产生6位组合随机数

组合 产生 随机数
2023-09-14 09:03:41 时间

private static String RandomAdminId() {
  String str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  String strIndex = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

  StringBuffer strB = new StringBuffer("");
  int index = (int) (51 * Math.random());
  strB.append(strIndex.charAt(index));

  for (int i = 0; i <= 4; i++) {
    int j = (int) (61 * Math.random());
    strB.append(str.charAt(j));
  }
  return strB.toString();
}