Package org.apache.commons.math3.random

# Class JDKRandomGenerator

java.lang.Object
java.util.Random
org.apache.commons.math3.random.JDKRandomGenerator

All Implemented Interfaces:
  `Serializable`, `java.util.random.RandomGenerator`, `RandomGenerator`

public class JDKRandomGenerator extends Random implements RandomGenerator
Extension of `java.util.Random` to implement `RandomGenerator`.

Since:
  1.1
See Also:
  - Serialized Form

## Nested Class Summary

## Nested classes/interfaces inherited from interface java.util.random.RandomGenerator

`java.util.random.RandomGenerator.ArbitrarilyJumpableGenerator, java.util.random.RandomGenerator.JumpableGenerator, java.util.random.RandomGenerator.LeapableGenerator, java.util.random.RandomGenerator.SplittableGenerator, java.util.random.RandomGenerator.StreamableGenerator`

## Constructor Summary

Constructors
Constructor
Description
`JDKRandomGenerator()`
Create a new JDKRandomGenerator with a default seed.
`JDKRandomGenerator(int seed)`
Create a new JDKRandomGenerator with the given seed.

## Method Summary

Modifier and Type
Method
Description
`void`
`setSeed(int seed)`
Sets the seed of the underlying random number generator using an `int` seed.
`void`
`setSeed(int[] seed)`
Sets the seed of the underlying random number generator using an `int` array seed.

### Methods inherited from class java.util.Random

`doubles, doubles, doubles, doubles, from, ints, ints, ints, ints, longs, longs, longs, longs, next, nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, setSeed`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.util.random.RandomGenerator

`isDeprecated, nextDouble, nextDouble, nextExponential, nextFloat, nextFloat, nextGaussian, nextInt, nextLong, nextLong`

### Methods inherited from interface org.apache.commons.math3.random.RandomGenerator

`nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, setSeed`

## Constructor Details

### JDKRandomGenerator

public JDKRandomGenerator()
Create a new JDKRandomGenerator with a default seed.

### JDKRandomGenerator

public JDKRandomGenerator(int seed)
Create a new JDKRandomGenerator with the given seed.

Parameters:
  `seed` - initial seed
Since:
  3.6

## Method Details

### setSeed

public void setSeed(int seed)
Sets the seed of the underlying random number generator using an `int` seed.

Sequences of values generated starting with the same seeds should be identical.

Specified by:
  `setSeed` in interface `RandomGenerator`
Parameters:
  `seed` - the seed value

### setSeed

public void setSeed(int[] seed)
Sets the seed of the underlying random number generator using an `int` array seed.

Sequences of values generated starting with the same seeds should be identical.

Specified by:
  `setSeed` in interface `RandomGenerator`
Parameters:
  `seed` - the seed value