MCPcopy Create free account
hub / github.com/0linlin0/CyberBox / generateRandomStr

Method generateRandomStr

Skay_Exp/src/tools/Random_Str.java:6–15  ·  view source on GitHub ↗
(int length)

Source from the content-addressed store, hash-verified

4
5public class Random_Str {
6 public static String generateRandomStr(int length) {
7 String base = "abcdefghijklmnopqrstuvwxyz0123456789";
8 Random random = new Random();
9 StringBuilder sb = new StringBuilder();
10 for (int i = 0; i < length; i++) {
11 int number = random.nextInt(base.length());
12 sb.append(base.charAt(number));
13 }
14 return sb.toString();
15 }
16}

Callers 1

testMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected