Package net.messagevortex
Class ExtendedSecureRandom
java.lang.Object
net.messagevortex.ExtendedSecureRandom
A Specialized random number generator for MessageVortex.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]generateSeed(int i) Returns the given number of seed bytes, computed using the seed generation algorithm that this class uses to seed itself.static SecureRandomReturns an internal representation of the secure Random number generator.static voidnextBytes(byte[] array) An array filled with random byte values.static doubleReturns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.static doubleReturns a gaussian distributed value between 0 and 1 (maximum at 0.5).static intnextInt(int bound) Returns an integer between 0 and bound-1.static intnextInt(int low, int up) Returns an integer between low and up-1.static doublenextRandomTime(long start, long peak, long end) Returns a random time.
-
Constructor Details
-
ExtendedSecureRandom
public ExtendedSecureRandom()
-
-
Method Details
-
nextInt
public static int nextInt(int bound) Returns an integer between 0 and bound-1.
- Parameters:
bound- the maximum value to be used- Returns:
- a random integer value between 0 and bound-1
-
nextInt
public static int nextInt(int low, int up) Returns an integer between low and up-1.
- Parameters:
low- the minimum value to be returnedup- the maximum value to be used- Returns:
- a random integer value between low and up-1
- Throws:
IllegalArgumentException- if low >= up
-
nextBytes
public static void nextBytes(byte[] array) An array filled with random byte values.
- Parameters:
array- the array to be filled
-
generateSeed
public static byte[] generateSeed(int i) Returns the given number of seed bytes, computed using the seed generation algorithm that this class uses to seed itself.
- Parameters:
i- the number of bytes to be generated- Returns:
- the seed bytes
-
nextDouble
public static double nextDouble()Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.
- Returns:
- the next pseudorandom value
-
getSecureRandom
Returns an internal representation of the secure Random number generator.
- Returns:
- the random number generator
-
nextGauss
public static double nextGauss()Returns a gaussian distributed value between 0 and 1 (maximum at 0.5).
- Returns:
- a gaussian random value
-
nextRandomTime
public static double nextRandomTime(long start, long peak, long end) Returns a random time.
- Parameters:
start- the earliest allowed timepeak- the peak time (50% chance)end- the latest time- Returns:
- a gaussian random value
-