Package net.bytebuddy.utility
Class RandomString
- java.lang.Object
-
- net.bytebuddy.utility.RandomString
-
public class RandomString extends java.lang.Object
A provider of randomizedString
values.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_LENGTH
The default length of a randomizedString
.private static int
KEY_BITS
The amount of bits to extract out of an integer for each key generated.private int
length
The length of the random strings that are created by this instance.private java.util.Random
random
A provider of random values.private static char[]
SYMBOL
The symbols which are used to create a randomString
.
-
Constructor Summary
Constructors Constructor Description RandomString()
RandomString(int length)
Creates a randomString
provider where each value is of the given length.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
hashOf(int value)
Represents an integer value as a string hash.static java.lang.String
make()
Creates a randomString
ofDEFAULT_LENGTH
length.static java.lang.String
make(int length)
Creates a randomString
of the givenlength
.java.lang.String
nextString()
Creates a new randomString
.
-
-
-
Field Detail
-
DEFAULT_LENGTH
public static final int DEFAULT_LENGTH
The default length of a randomizedString
.- See Also:
- Constant Field Values
-
SYMBOL
private static final char[] SYMBOL
The symbols which are used to create a randomString
.
-
KEY_BITS
private static final int KEY_BITS
The amount of bits to extract out of an integer for each key generated.
-
random
private final java.util.Random random
A provider of random values.
-
length
private final int length
The length of the random strings that are created by this instance.
-
-
Method Detail
-
make
public static java.lang.String make()
Creates a randomString
ofDEFAULT_LENGTH
length.- Returns:
- A random
String
.
-
make
public static java.lang.String make(int length)
Creates a randomString
of the givenlength
.- Parameters:
length
- The length of the randomString
.- Returns:
- A random
String
.
-
hashOf
public static java.lang.String hashOf(int value)
Represents an integer value as a string hash. This string is not technically random but generates a fixed character sequence based on the hash provided.- Parameters:
value
- The value to represent as a string.- Returns:
- A string representing the supplied value as a string.
-
nextString
public java.lang.String nextString()
Creates a new randomString
.- Returns:
- A random
String
of the given length for this instance.
-
-