Top Description Fields Constructors Methods
io.netty.handler.ssl.util

pack-priv final Class ThreadLocalInsecureRandom

extends SecureRandom
Class Inheritance
Imports
io.netty.util.internal.PlatformDependent, java.security.SecureRandom, java.util.Random

Insecure SecureRandom which relies on PlatformDependent#threadLocalRandom() for random number generation.

Field Summary

Modifier and TypeField and Description
private static final SecureRandom
private static final long

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static SecureRandom
public byte[]
generateSeed(int
the number of seed bytes to generate.
numBytes
)

Overrides java.security.SecureRandom.generateSeed.

Returns the given number of seed bytes, computed using the seed generation algorithm that this class uses to seed itself.
public String
getAlgorithm()

Overrides java.security.SecureRandom.getAlgorithm.

Returns the name of the algorithm implemented by this SecureRandom object.
public boolean
nextBoolean()

Overrides java.util.Random.nextBoolean.

Overrides default java.util.random.RandomGenerator.nextBoolean.

Returns the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence.
public void
nextBytes(byte[]
the array to be filled in with random bytes.
bytes
)

Overrides java.security.SecureRandom.nextBytes.

Overrides default java.util.random.RandomGenerator.nextBytes.

Generates a user-specified number of random bytes.
public double
nextDouble()

Overrides java.util.Random.nextDouble.

Overrides default java.util.random.RandomGenerator.nextDouble.

Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.
public float
nextFloat()

Overrides java.util.Random.nextFloat.

Overrides default java.util.random.RandomGenerator.nextFloat.

Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.
public double
nextGaussian()

Overrides java.util.Random.nextGaussian.

Overrides default java.util.random.RandomGenerator.nextGaussian.

Returns the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence.
public int
nextInt()

Overrides java.util.Random.nextInt.

Overrides default java.util.random.RandomGenerator.nextInt.

Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence.
public int
nextInt(int
the upper bound (exclusive). Must be positive.
n
)

Overrides java.util.Random.nextInt.

Overrides default java.util.random.RandomGenerator.nextInt.

Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.
public long
nextLong()

Overrides java.util.Random.nextLong.

Implements java.util.random.RandomGenerator.nextLong.

Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence.
private static Random
public void
setSeed(byte[]
the seed.
seed
)

Overrides java.security.SecureRandom.setSeed.

Reseeds this random object with the given seed.
public void
setSeed(long
the seed.
seed
)

Overrides java.security.SecureRandom.setSeed.

Reseeds this random object, using the eight bytes contained in the given long seed.
Inherited from java.security.SecureRandom:
getInstancegetInstancegetInstancegetInstancegetInstancegetInstancegetInstanceStronggetParametersgetProvidergetSeednextnextBytesreseedreseedtoString

Field Detail

INSTANCEback to summary
private static final SecureRandom INSTANCE
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.SecureRandom.serialVersionUID.

Constructor Detail

ThreadLocalInsecureRandomback to summary
private ThreadLocalInsecureRandom()

Method Detail

currentback to summary
pack-priv static SecureRandom current()
generateSeedback to summary
public byte[] generateSeed(int numBytes)

Overrides java.security.SecureRandom.generateSeed.

Doc from java.security.SecureRandom.generateSeed.

Returns the given number of seed bytes, computed using the seed generation algorithm that this class uses to seed itself. This call may be used to seed other random number generators.

Parameters
numBytes:int

the number of seed bytes to generate.

Returns:byte[]

the seed bytes.

Annotations
@Override
getAlgorithmback to summary
public String getAlgorithm()

Overrides java.security.SecureRandom.getAlgorithm.

Doc from java.security.SecureRandom.getAlgorithm.

Returns the name of the algorithm implemented by this SecureRandom object.

Returns:String

the name of the algorithm or unknown if the algorithm name cannot be determined.

Annotations
@Override
nextBooleanback to summary
public boolean nextBoolean()

Overrides java.util.Random.nextBoolean.

Overrides default java.util.random.RandomGenerator.nextBoolean.

Doc from java.util.Random.nextBoolean.

Returns the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence. The general contract of nextBoolean is that one boolean value is pseudorandomly generated and returned. The values true and false are produced with (approximately) equal probability.

Returns:boolean

the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence

Annotations
@Override
nextBytesback to summary
public void nextBytes(byte[] bytes)

Overrides java.security.SecureRandom.nextBytes.

Overrides default java.util.random.RandomGenerator.nextBytes.

Doc from java.security.SecureRandom.nextBytes.

Generates a user-specified number of random bytes.

Parameters
bytes:byte[]

the array to be filled in with random bytes.

Annotations
@Override
nextDoubleback to summary
public double nextDouble()

Overrides java.util.Random.nextDouble.

Overrides default java.util.random.RandomGenerator.nextDouble.

Doc from java.util.Random.nextDouble.

Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.

The general contract of nextDouble is that one double value, chosen (approximately) uniformly from the range 0.0d (inclusive) to 1.0d (exclusive), is pseudorandomly generated and returned.

Returns:double

the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence

Annotations
@Override
nextFloatback to summary
public float nextFloat()

Overrides java.util.Random.nextFloat.

Overrides default java.util.random.RandomGenerator.nextFloat.

Doc from java.util.Random.nextFloat.

Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.

The general contract of nextFloat is that one float value, chosen (approximately) uniformly from the range 0.0f (inclusive) to 1.0f (exclusive), is pseudorandomly generated and returned. All 224 possible float values of the form m x 2-24, where m is a positive integer less than 224, are produced with (approximately) equal probability.

Returns:float

the next pseudorandom, uniformly distributed float value between 0.0f and 1.0f from this random number generator's sequence

Annotations
@Override
nextGaussianback to summary
public double nextGaussian()

Overrides java.util.Random.nextGaussian.

Overrides default java.util.random.RandomGenerator.nextGaussian.

Doc from java.util.Random.nextGaussian.

Returns the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence.

The general contract of nextGaussian is that one double value, chosen from (approximately) the usual normal distribution with mean 0.0 and standard deviation 1.0, is pseudorandomly generated and returned.

Returns:double

the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence

Annotations
@Override
nextIntback to summary
public int nextInt()

Overrides java.util.Random.nextInt.

Overrides default java.util.random.RandomGenerator.nextInt.

Doc from java.util.Random.nextInt.

Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence. The general contract of nextInt is that one int value is pseudorandomly generated and returned. All 232 possible int values are produced with (approximately) equal probability.

Returns:int

the next pseudorandom, uniformly distributed int value from this random number generator's sequence

Annotations
@Override
nextIntback to summary
public int nextInt(int n)

Overrides java.util.Random.nextInt.

Overrides default java.util.random.RandomGenerator.nextInt.

Doc from java.util.Random.nextInt.

Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence. The general contract of nextInt is that one int value in the specified range is pseudorandomly generated and returned. All bound possible int values are produced with (approximately) equal probability.

Parameters
n:int

the upper bound (exclusive). Must be positive.

Returns:int

the next pseudorandom, uniformly distributed int value between zero (inclusive) and bound (exclusive) from this random number generator's sequence

Annotations
@Override
nextLongback to summary
public long nextLong()

Overrides java.util.Random.nextLong.

Implements java.util.random.RandomGenerator.nextLong.

Doc from java.util.Random.nextLong.

Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence. The general contract of nextLong is that one long value is pseudorandomly generated and returned.

Returns:long

the next pseudorandom, uniformly distributed long value from this random number generator's sequence

Annotations
@Override
randomback to summary
private static Random random()
setSeedback to summary
public void setSeed(byte[] seed)

Overrides java.security.SecureRandom.setSeed.

Doc from java.security.SecureRandom.setSeed.

Reseeds this random object with the given seed. The seed supplements, rather than replaces, the existing seed. Thus, repeated calls are guaranteed never to reduce randomness.

A PRNG SecureRandom will not seed itself automatically if setSeed is called before any nextBytes or reseed calls. The caller should make sure that the seed argument contains enough entropy for the security of this SecureRandom.

Parameters
seed:byte[]

the seed.

Annotations
@Override
setSeedback to summary
public void setSeed(long seed)

Overrides java.security.SecureRandom.setSeed.

Doc from java.security.SecureRandom.setSeed.

Reseeds this random object, using the eight bytes contained in the given long seed. The given seed supplements, rather than replaces, the existing seed. Thus, repeated calls are guaranteed never to reduce randomness.

A PRNG SecureRandom will not seed itself automatically if setSeed is called before any nextBytes or reseed calls. The caller should make sure that the seed argument contains enough entropy for the security of this SecureRandom.

This method is defined for compatibility with java.util.Random.

Parameters
seed:long

the seed.

Annotations
@Override