Class ExtendedSecureRandom

java.lang.Object
net.messagevortex.ExtendedSecureRandom

public final class ExtendedSecureRandom extends Object

A Specialized random number generator for MessageVortex.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    Returns an internal representation of the secure Random number generator.
    static void
    nextBytes(byte[] array)
    An array filled with random byte values.
    static double
    Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.
    static double
    Returns a gaussian distributed value between 0 and 1 (maximum at 0.5).
    static int
    nextInt(int bound)
    Returns an integer between 0 and bound-1.
    static int
    nextInt(int low, int up)
    Returns an integer between low and up-1.
    static double
    nextRandomTime(long start, long peak, long end)
    Returns a random time.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 returned
      up - 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

      public static SecureRandom 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 time
      peak - the peak time (50% chance)
      end - the latest time
      Returns:
      a gaussian random value