Package org.apache.sshd.common.random
Class SingletonRandomFactory
- java.lang.Object
-
- org.apache.sshd.common.random.AbstractRandom
-
- org.apache.sshd.common.random.SingletonRandomFactory
-
- All Implemented Interfaces:
Supplier<Random>,BuiltinFactory<Random>,Factory<Random>,NamedFactory<Random>,NamedResource,OptionalFeature,Random,RandomFactory
public class SingletonRandomFactory extends AbstractRandom implements RandomFactory
A random factory wrapper that uses a single random instance. The underlying random instance has to be thread safe.- Author:
- Apache MINA SSHD Project
-
-
Field Summary
-
Fields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTOR
-
Fields inherited from interface org.apache.sshd.common.OptionalFeature
FALSE, TRUE
-
-
Constructor Summary
Constructors Constructor Description SingletonRandomFactory(NamedFactory<Random> factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Randomcreate()voidfill(byte[] bytes, int start, int len)Fill part of bytes with random values.StringgetName()booleanisSupported()intrandom(int max)Returns a pseudo-random uniformly distributedintin the half-open range [0, n).-
Methods inherited from class org.apache.sshd.common.random.AbstractRandom
toString
-
-
-
-
Constructor Detail
-
SingletonRandomFactory
public SingletonRandomFactory(NamedFactory<Random> factory)
-
-
Method Detail
-
isSupported
public boolean isSupported()
- Specified by:
isSupportedin interfaceOptionalFeature
-
fill
public void fill(byte[] bytes, int start, int len)Description copied from interface:RandomFill part of bytes with random values.
-
random
public int random(int max)
Description copied from interface:RandomReturns a pseudo-random uniformly distributedintin the half-open range [0, n).
-
getName
public String getName()
- Specified by:
getNamein interfaceNamedResource- Returns:
- The resource name
-
-