@ThreadSafe public final class FastRandom extends Object
Normally such a class should have been implemented upon using the time system with currentTimeMills(), however this was avoided for two reasons:
Note that the methods which produce a random using the hash is not a seed. The next number is never ever consistent unless nanoTime returns the same value and the hashed object is the same. The methods which do not provide a hash do not create a new object, rather it does not hash the nanoTime at all.
Modifier and Type | Method and Description |
---|---|
static long |
random()
Finds a random number
|
static long |
random(int upper)
Finds a random number with an upper limit
|
static long |
random(int upper,
Object hash)
Finds a random number with a hash
|
static long |
random(Object hash)
Finds a random number with a hash
|
public static long random()
public static long random(int upper)
upper
- the returned value is < upperpublic static long random(Object hash)
hash
- the object to randomize the hash with hashCodeCopyright © 2016. All rights reserved.