summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/cmcc/simulator/util/StringUtil.java
blob: 002e7f0ca0f095045996c8ccf2ed511a02302516 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.cmcc.simulator.util;

public class StringUtil {

	public static String randomStr(int len) {
		if (len == 0) {
			return "";
		}
		int a = (int) (Math.random() * 3);
		if (a == 0) {
			return ((int) (Math.random() * 10)) + randomStr(len - 1);
		} else {
			return ((char) ((int) (Math.random() * 26) + 65)) + randomStr(len - 1);
		}
	}
	
//	public static void main(String[] args) {
//		System.out.println(randomStr(2));
//	}

}