// 生成订单号 public static String setRandomChar() { String str = ""; for (int i = 0; i < 10; i++) { int ch = (int) (10 * (Math.random())); str = str + ch; } return str; } // 生成优惠券号 前四位大写字母 后六位数字 public static String genCouponCode() { String str = ""; for (int i = 0; i < 4; i++) { int ch = ((int)'A')+ (int) (26 * (Math.random())); str = str +(char)ch; } for (int i = 0; i < 6; i++) { int ch = (int) (10 * (Math.random())); str = str + ch; } return str; }