Package org.apache.commons.math4.random
Class RandomUtils
java.lang.Object
org.apache.commons.math4.random.RandomUtils
public class RandomUtils
extends java.lang.Object
Factory for creating generators of miscellaneous data.
- Since:
- 4.0
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRandomUtils.DataGeneratorVarious random data generation routines. -
Method Summary
Modifier and Type Method Description static UniformRandomProviderasUniformRandomProvider(java.util.Random rng)Wraps aRandominstance.static RandomUtils.DataGeneratorcreateDataGenerator(java.util.Random rng)Wraps an instance of the JDK'sRandomclass.static RandomUtils.DataGeneratorcreateDataGenerator(UniformRandomProvider rng)
-
Method Details
-
createDataGenerator
- Parameters:
rng- Underlying generator. Reference is copied so the RNG is shared with the caller.- Returns:
- a
data generator.
-
createDataGenerator
Wraps an instance of the JDK'sRandomclass. The actual generation of random numbers will be delegated to that instance.If cryptographically secure data is required, one can use this factory method, with an instance of the
SecureRandomclass as the argument. Note that data generation will be much slower in this case.- Parameters:
rng- Underlying generator. Reference is copied so the RNG is shared with the caller.- Returns:
- a
data generator.
-
asUniformRandomProvider
Wraps aRandominstance.- Parameters:
rng- JDKRandominstance to which the random number generation is delegated. Reference is copied so the RNG is shared with the caller.- Returns:
- a
UniformRandomProviderinstance.
-