1 package com.fermod.util;
3 import java.security.SecureRandom;
4 import java.util.Locale;
5 import java.util.Objects;
6 import java.util.Random;
13 public static final String
UPPER =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
14 public static final String
LOWER =
UPPER.toLowerCase(Locale.ROOT);
15 public static final String
DIGITS =
"0123456789";
31 throw new IllegalArgumentException();
34 throw new IllegalArgumentException();
36 this.random = Objects.requireNonNull(
random);
37 this.symbols =
symbols.toCharArray();
38 this.buffer =
new char[length];
60 this(length,
new SecureRandom(),
symbols);
72 this(length,
new SecureRandom());
93 for (
int i = 0; i <
buffer.length; ++i) {
RandomString(int length, Random random)
Constructs a new random string generator instance.
static final String LOWER
static final String UPPER
RandomString(int length)
Constructs a new random string generator instance used to create pseudorandom strings from a secure g...
RandomString(int length, String symbols)
Constructs a new random string generator instance used to create pseudorandom strings from a secure g...
String nextString()
Returns a pseudorandom, uniformly distributed.
static final String ALPHANUM
RandomString(int length, Random random, String symbols)
Constructs a new random string generator instance used to create pseudorandom strings.
A class to generate pseudorandom sequences of strings.
static final String DIGITS