Member Functions | ||
deepenShallowCopy() operator()() |
operator=() reference() |
restart() |
#include <rw/randgen.h> RWRandGenerator gen;
Class RWRandGenerator generates random numbers uniformly distributed over the interval [0, 1]. RWRandGenerator objects can be independent or share state with each other. Math.h++ contains a global default state that is shared by all generators created with the default constructor. Using the default generator state does not guarantee repeatable sequences, even if you restart() it using a specific seed. This is because the global state may be shared among several applications in a multithreaded environment. There is no protection against multiple threads of control using the global default state at the same time. To achieve repeatable sequences, you must construct a generator with a specific seed value and use the generator for random number generation.
RWRandGenerator();
Constructs a generator with the shared global default state.
RWRandGenerator(const RWRandGenerator& x);
Constructs a copy of x. The generators share state.
RWRandGenerator(long seed);
Constructs a generator with specified initial seed. The generator has its own state.
void deepenShallowCopy();
Makes the state independent, but doesn't change it.
void restart();
Restarts the generator with a random seed.
void restart(long seed);
Restarts the generator with the specified seed.
void reference(const RWRandGenerator& x);
Sets state to argument's state.
double operator()();
Returns a random double in [0, 1].
RWRandGenerator& operator=(const RWRandGenerator& x);
Sets state to argument's state.
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.