java.io.Serializable@Private
public class OpensslSecureRandom
extends java.util.Random
If using an Intel chipset with RDRAND, the high-performance hardware
random number generator will be used and it's much faster than
SecureRandom. If RDRAND is unavailable, default
OpenSSL secure random generator will be used. It's still faster
and can generate strong random bytes.
See https://wiki.openssl.org/index.php/Random_Numbers See http://en.wikipedia.org/wiki/RdRand
| Constructor | Description |
|---|---|
OpensslSecureRandom() |
| Modifier and Type | Method | Description |
|---|---|---|
static boolean |
isNativeCodeLoaded() |
|
protected int |
next(int numBits) |
Generates an integer containing the user-specified number of
random bits (right justified, with leading zeros).
|
void |
nextBytes(byte[] bytes) |
Generates a user-specified number of random bytes.
|
void |
setSeed(long seed) |
public static boolean isNativeCodeLoaded()
public void nextBytes(byte[] bytes)
nextBytes in class java.util.Randombytes - the array to be filled in with random bytes.public void setSeed(long seed)
setSeed in class java.util.Randomprotected final int next(int numBits)
next in class java.util.RandomnumBits - number of random bits to be generated, where
0 <= numBits <= 32.int containing the user-specified number
of random bits (right justified, with leading zeros).Copyright © 2008–2025 Apache Software Foundation. All rights reserved.