Documentation API of the 'org.apache.commons.math3.random.RandomDataImpl' Java class

Class RandomDataImpl

  • All Implemented Interfaces:
    Serializable, RandomData

    to be removed in 4.0. Use RandomDataGenerator instead

    @Deprecatedpublic class RandomDataImplextends Objectimplements RandomData, Serializable
    Generates random deviates and other random data using a RandomGenerator instance to generate non-secure data and a SecureRandom instance to provide data for the nextSecureXxx methods. If no RandomGenerator is provided in the constructor, the default is to use a Well19937c generator. To plug in a different implementation, either implement RandomGenerator directly or extend AbstractRandomGenerator.

    Supports reseeding the underlying pseudo-random number generator (PRNG). The SecurityProvider and Algorithm used by the SecureRandom instance can also be reset.

    For details on the default PRNGs, see Random and SecureRandom.

    Usage Notes:

    • Instance variables are used to maintain RandomGenerator and SecureRandom instances used in data generation. Therefore, to generate a random sequence of values or strings, you should use just one RandomDataGenerator instance repeatedly.
    • The "secure" methods are *much* slower. These should be used only when a cryptographically secure random sequence is required. A secure random sequence is a sequence of pseudo-random values which, in addition to being well-dispersed (so no subsequence of values is an any more likely than other subsequence of the the same length), also has the additional property that knowledge of values generated up to any point in the sequence does not make it any easier to predict subsequent values.
    • When a new RandomDataGenerator is created, the underlying random number generators are not initialized. If you do not explicitly seed the default non-secure generator, it is seeded with the current time in milliseconds plus the system identity hash code on first use. The same holds for the secure generator. If you provide a RandomGenerator to the constructor, however, this generator is not reseeded by the constructor nor is it reseeded on first use.
    • The reSeed and reSeedSecure methods delegate to the corresponding methods on the underlying RandomGenerator and SecureRandom instances. Therefore, reSeed(long) fully resets the initial state of the non-secure random number generator (so that reseeding with a specific value always results in the same subsequent random sequence); whereas reSeedSecure(long) does not reinitialize the secure random number generator (so secure sequences started with calls to reseedSecure(long) won't be identical).
    • This implementation is not synchronized. The underlying RandomGenerator or SecureRandom instances are not protected by synchronization and are not guaranteed to be thread-safe. Therefore, if an instance of this class is concurrently utilized by multiple threads, it is the responsibility of client code to synchronize access to seeding and data generation methods.

    See Also:
    Serialized Form

Warning: You cannot see the full API documentation of this class since the access to the DatMelt documentation for third-party Java classes is denied. Guests can only view jhplot Java API. To view the complete description of this class and its methods, please request the full DataMelt membership.

If you are already a full member, please login to the DataMelt member area before visiting this documentation.