public final class RandomUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getPseudoAlphanumericText(int length)
Returns random text characters (uses the 0..9, A..Z and a..z character sets).
|
static java.lang.String |
getPseudoBase64Text(int length)
Returns random text characters (uses the Base64 set).
|
static byte[] |
getPseudoBytes(int length)
Returns random bytes, created by the information entropy from bytes in a newly created Guid.
|
static int |
getPseudoInt32()
Returns a random Int32, created by the information entropy from bytes in a newly created UUID.
|
static int |
getPseudoInt32(int min,
int max)
Returns a pseudo random within the specified range [min, max) i.e.
|
static long |
getPseudoInt64()
Returns a random Int64, created by the information entropy from bytes in a newly created UUID.
|
static java.lang.String |
getSecureAlphanumericText(int length)
Returns random text characters (uses the 0..9, A..Z and a..z character sets) created by a cryptographically secure source.
|
static java.lang.String |
getSecureBase64Text(int length)
Returns random text characters (uses the Base64 set), created by a cryptographically secure source.
|
static byte[] |
getSecureBytes(int length)
Returns a key filled with cryptographically secure random data.
|
static int |
getSecureInt32()
Returns a cryptographically secure random Int32.
|
static long |
getSecureInt64()
Returns a cryptographically secure random Int32.
|
static <T> void |
pseudoRandomize(java.util.List<T> data,
int start,
int end)
Randomizes elements in an array.
|
static <T> void |
pseudoRandomize(T[] data,
int start,
int end)
Randomizes elements in an array.
|
public static int getPseudoInt32()
public static int getPseudoInt32(int min, int max)
java.lang.IllegalArgumentException
- An argument is out of rangepublic static long getPseudoInt64()
public static byte[] getPseudoBytes(int length)
java.lang.IllegalArgumentException
- An argument is out of rangepublic static java.lang.String getPseudoBase64Text(int length)
java.lang.IllegalArgumentException
- An argument is out of range.public static java.lang.String getPseudoAlphanumericText(int length)
java.lang.IllegalArgumentException
- An argument is out of range.public static <T> void pseudoRandomize(T[] data, int start, int end)
java.lang.NullPointerException
- An argument is null.java.lang.IndexOutOfBoundsException
- An index is out of range.public static <T> void pseudoRandomize(java.util.List<T> data, int start, int end)
java.lang.NullPointerException
- An argument is null.java.lang.IndexOutOfBoundsException
- An index is out of range.public static int getSecureInt32()
public static long getSecureInt64()
public static byte[] getSecureBytes(int length)
java.lang.IllegalArgumentException
- An argument is out of rangepublic static java.lang.String getSecureBase64Text(int length)
java.lang.IllegalArgumentException
- An argument is out of rangepublic static java.lang.String getSecureAlphanumericText(int length)
java.lang.IllegalArgumentException
- An argument is out of range