Class ThreadIDRNG
java.lang.Object
dev.nm.stat.random.rng.concurrent.context.ContextRNG<Long>
dev.nm.stat.random.rng.concurrent.context.ThreadIDRNG
- All Implemented Interfaces:
RandomNumberGenerator
,Seedable
- Direct Known Subclasses:
ThreadIDRLG
This random number generator generates independent sequences of random numbers per thread, hence
thread-safe.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class dev.nm.stat.random.rng.concurrent.context.ContextRNG
getRNG, nextDouble, removeContext, seed
-
Constructor Details
-
ThreadIDRNG
public ThreadIDRNG(int N, long seed) Constructs a per-context repeatable RNG.- Parameters:
N
- the maximum number of threadsseed
- a seed
-
-
Method Details
-
setContext
public void setContext(long context) Sets the context of this thread.- Parameters:
context
- a context
-