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

Class Random_Str

Skay_Exp/src/tools/Random_Str.java:5–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import java.util.Random;
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

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected