Back to project page android-json-http.
The source code is released under:
Apache License
If you think the Android project android-json-http listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.open.jsonhttp.util; //from w w w.j a v a 2 s . c o m import java.util.Random; /** * ?????? * * @author yinghui.hong */ public class StringUtil { private static final char[] SOURCE = "123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ" .toCharArray(); // FUNO FIX OK ??????????????????????? /** * ??????????? * * @param length * @return */ public static String getRandomStr(int length) { if (length < 1) { return null; } Random random = new Random(); char[] buf = new char[length]; int index = 0; for (int i = 0; i < length; i++) { index = random.nextInt(SOURCE.length); buf[i] = SOURCE[index]; } return new String(buf); } }