public class SSRCGenerator
extends java.lang.Object
Constructor and Description |
---|
SSRCGenerator()
Creates an instance of SSRC Generator.
|
Modifier and Type | Method and Description |
---|---|
int |
generate()
Generates a random integer using Math.random() to get a fast generation,
but SecureRandom to give a good seed to Math.random() and garanties a good
randomness.
|
int |
generate(int salt)
Generates a random integer using Math.random() to get a fast generation,
but SecureRandom to give a good seed to Math.random() and garanties a good
randomness.
|
static long |
getSecuredSeed()
Generates a secured seed that can be used to initialize a PRNG (like Math.random).
|
static byte[] |
getSecuredSeed(int n)
Generates a secured seed that can be used to initialize a PRNG (like Math.random).
|
static int |
nextSecuredRandomInt()
Returns an integer generated in a very secure way.
|
static long |
nextSecuredRandomLong()
Returns a long generated in a very secure way.
|
static short |
nextSecuredRandomShort()
Returns a short integer generated in a very secure way.
|
double |
random()
Generates a random double between 0 and 1.
|
public int generate()
public int generate(int salt)
salt
- The "salt" argument is used if we have to generate several SSRCs in
a very close succession (the hashs could be the same depending since
the standard Random PRNG is time-based). This situation is very
unlikely to happen.public static long getSecuredSeed()
public static byte[] getSecuredSeed(int n)
n
- number of bytes on which to generate the seedpublic static long nextSecuredRandomLong()
public static int nextSecuredRandomInt()
public static short nextSecuredRandomShort()
public double random()