MCPcopy Create free account
hub / github.com/Berkeley-CS61B/skeleton-sp23 / randomString

Method randomString

lab08/tests/speed/StringUtils.java:22–28  ·  view source on GitHub ↗

Returns the next random string of length LENGTH.

(int length)

Source from the content-addressed store, hash-verified

20
21 /** Returns the next random string of length LENGTH. */
22 public static String randomString(int length) {
23 char[] someChars = new char[length];
24 for (int i = 0; i < length; i++) {
25 someChars[i] = (char) (r.nextInt(ALPHABET_SIZE) + 'a');
26 }
27 return new String(someChars);
28 }
29
30 /**
31 * Returns true if string S consists of characters between

Callers 2

insertRandomMethod · 0.95
insertRandomMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected