You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
494 B
17 lines
494 B
package com.keylesspalace.tusky.util;
|
|
|
|
import java.util.Random;
|
|
|
|
public class StringUtils {
|
|
|
|
public static String randomAlphanumericString(int count) {
|
|
char[] chars = new char[count];
|
|
Random random = new Random();
|
|
final String POSSIBLE_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
for (int i = 0; i < count; i++) {
|
|
chars[i] = POSSIBLE_CHARS.charAt(random.nextInt(POSSIBLE_CHARS.length()));
|
|
}
|
|
return new String(chars);
|
|
}
|
|
|
|
}
|
|
|