| Modifier and Type | Field and Description |
|---|---|
| pack-priv static SecureRandom | secureRandom
The secure random object. |
| pack-priv static volatile boolean | seeded
True if the secure random object is seeded. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static short | Returns: the converted short valuethe value to convert i)Convert an int value to a short value. |
| public static int | Returns: the converted int valuethe value to convert l)Convert a long value to an int value. |
| public static byte[] | Returns: the seedGenerate a seed value, using as much unpredictable data as possible. |
| private static synchronized SecureRandom | |
| public static int | Returns: the next power of two valuethe original value x)Get the value that is equal to or higher than this value, and that is a power of two. |
| public static void | |
| public static int | Returns: the random long valuethe value returned will be lower than this value lowerThan)Get a pseudo random int value between 0 (including and the given value (excluding). |
| public static int | Returns: the rounded valuethe value to be rounded x, int the block size blockSizePowerOf2)Round the value up to the next block size. |
| public static long | Returns: the rounded valuethe value to be rounded x, long the block size blockSizePowerOf2)Round the value up to the next block size. |
| public static byte[] | Returns: the random bytesthe number of bytes len)Get a number of cryptographically secure pseudo random bytes. |
| public static int | Returns: the random long valuethe value returned will be lower than this value lowerThan)Get a cryptographically secure pseudo random int value between 0 (including and the given value (excluding). |
| public static long | Returns: the random long valueGet a cryptographically secure pseudo random long value. |
| pack-priv static void |
| secureRandom | back to summary |
|---|---|
| pack-priv static SecureRandom secureRandom The secure random object. | |
| seeded | back to summary |
|---|---|
| pack-priv static volatile boolean seeded True if the secure random object is seeded. | |
| MathUtils | back to summary |
|---|---|
| private MathUtils() | |
| convertIntToShort | back to summary |
|---|---|
| public static short convertIntToShort(int i) Convert an int value to a short value. Values larger than the biggest short value are converted to the biggest short value, and values smaller than the smallest short value are converted to the smallest short value.
| |
| convertLongToInt | back to summary |
|---|---|
| public static int convertLongToInt(long l) Convert a long value to an int value. Values larger than the biggest int value are converted to the biggest int value, and values smaller than the smallest int value are converted to the smallest int value.
| |
| generateAlternativeSeed | back to summary |
|---|---|
| public static byte[] generateAlternativeSeed() Generate a seed value, using as much unpredictable data as possible.
| |
| getSecureRandom | back to summary |
|---|---|
| private static synchronized SecureRandom getSecureRandom() | |
| nextPowerOf2 | back to summary |
|---|---|
| public static int nextPowerOf2(int x) throws IllegalArgumentException Get the value that is equal to or higher than this value, and that is a power of two.
| |
| randomBytes | back to summary |
|---|---|
| public static void randomBytes(byte[] bytes) Get a number of pseudo random bytes.
| |
| randomInt | back to summary |
|---|---|
| public static int randomInt(int lowerThan) Get a pseudo random int value between 0 (including and the given value (excluding). The value is not cryptographically secure.
| |
| roundUpInt | back to summary |
|---|---|
| public static int roundUpInt(int x, int blockSizePowerOf2) Round the value up to the next block size. The block size must be a power of two. As an example, using the block size of 8, the following rounding operations are done: 0 stays 0; values 1..8 results in 8, 9..16 results in 16, and so on.
| |
| roundUpLong | back to summary |
|---|---|
| public static long roundUpLong(long x, long blockSizePowerOf2) Round the value up to the next block size. The block size must be a power of two. As an example, using the block size of 8, the following rounding operations are done: 0 stays 0; values 1..8 results in 8, 9..16 results in 16, and so on.
| |
| secureRandomBytes | back to summary |
|---|---|
| public static byte[] secureRandomBytes(int len) Get a number of cryptographically secure pseudo random bytes.
| |
| secureRandomInt | back to summary |
|---|---|
| public static int secureRandomInt(int lowerThan) Get a cryptographically secure pseudo random int value between 0 (including and the given value (excluding).
| |
| secureRandomLong | back to summary |
|---|---|
| public static long secureRandomLong() Get a cryptographically secure pseudo random long value.
| |
| warn | back to summary |
|---|---|
| pack-priv static void warn(String s, Throwable t) Print a message to system output if there was a problem initializing the random number generator. | |