Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Authentication API v8.1 SP2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.rsa.ace.techservice.util
Class AceRandom

    java.lang.Object
      java.util.Random
          java.security.SecureRandom
              com.rsa.ace.techservice.util.AceRandom

All Implemented Interfaces:
  java.io.Serializable

    public class AceRandom

extends java.security.SecureRandom

Ace Random Number Generation Class.

This provides a singleton wrapper for the JSAFE_SecureRandom class. It also provides a variety of interfaces that can be used to either place random bytes in an existing array or allocate a random-filled byte array.

See Also:
  Serialized Form

Method Summary
`byte[]` | `getBytes(byte[] buffer)` Random byte generator.
`byte[]` | `getBytes(byte[] buffer, int offset, int length)` Random byte generator.
`byte[]` | `getBytes(int length)` Random byte generator.
`static AceRandom` | `getInstance()` Singleton-accessor.
`int` | `getInt()` Random integer generator.
`int` | `getInt(int minRange, int maxRange)` Random integer generator.
`int` | `nextInt(int maxRange)` Random integer generator.

Methods inherited from class java.security.SecureRandom
`generateSeed, getAlgorithm, getInstance, getInstance, getInstance, getProvider, getSeed, nextBytes, setSeed, setSeed`

Methods inherited from class java.util.Random
`nextBoolean, nextDouble, nextFloat, nextGaussian, nextInt, nextLong`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getBytes

    public byte[] getBytes(byte[] buffer,
                           int offset,
                           int length)

  Random byte generator. Wrapper for SecureRandom 'generateRandomBytes' interface. This interface returns a reference to the buffer provided allowing it to be filled and used in a single call.

  Parameters:
    `buffer` - A buffer to receive random bytes.
    `offset` - The starting offset at which random bytes will be placed.
    `length` - The length of the buffer passed. available.
  Returns:
    A reference to the buffer passed.

### getBytes

    public byte[] getBytes(byte[] buffer)

  Random byte generator.

  Parameters:
    `buffer` - The buffer into which the random bytes will be placed.
  Returns:
    A buffer with random bytes.

### getBytes

    public byte[] getBytes(int length)

  Random byte generator. Allocates a byte array and fills it with random data.

  Parameters:
    `length` - The length of the buffer returned.
  Returns:
    A buffer with random bytes.

### getInt

    public int getInt()

  Random integer generator. Gets the next random integer from the underlying PRNG.

  Returns:
    A random integer

### getInt

    public int getInt(int minRange,
                      int maxRange)

  Random integer generator. Allocates a byte array and fills it with random data.

  Parameters:
    `minRange` - The minimum range value. Typically 0 or 1.
    `maxRange` - The maximum range value, inclusive.
  Returns:
    A random integer

### nextInt

    public int nextInt(int maxRange)

  Random integer generator. Allocates a byte array and fills it with random data.

  Overrides:
    `nextInt` in class `java.util.Random`
  Parameters:
    `maxRange` - The maximum range value, inclusive.
  Returns:
    A random integer within range 0 to maxRange(inclusive)

### getInstance

    public static AceRandom getInstance()
                                 throws java.security.NoSuchAlgorithmException

  Singleton-accessor. Provides synchronized access to the single Random object.

  Throws:
    `java.security.NoSuchAlgorithmException` - If the desired random algorithm is not available.
    `AuthAgentException`
    `com.rsa.jsafe.JSAFE_InvalidUseException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Authentication API v8.1 SP2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999 - 2011 EMC Corporation. All Rights Reserved.