#include <RandomStream.h>
Public Member Functions | |
| RandomStream () | |
| Default constructor. | |
| RandomStream (long) | |
| Constructor with a seed number. | |
| long | nextLong () |
| Returns a random integer number in the range [1,2^32-2]. | |
| double | next () |
| Returns a random floating point number in the range (0,1). | |
| double | next (double) |
| Returns a random floating point number in the range [0,max). | |
| double | next (double, double) |
| Returns a random floating point number in the range [low,high]. | |
Private Attributes | |
| long | lastZ |
| Previous random number. | |
Static Private Attributes | |
| const long | modulus = 2147483647 |
| Constant = 2^31-1. | |
|
|
Default constructor. This method uses the current machine time as the seed for the random number stream. Definition at line 24 of file RandomStream.cpp. |
|
|
Constructor with a seed number. This method takes in a particular value for the stream's beginning value. Thus you can create the same stream of numbers using a particular seed value. Definition at line 38 of file RandomStream.cpp. |
|
||||||||||||
|
Returns a random floating point number in the range [low,high]. Notice that this method can return values in the full range of low to high, including the endpoint values. If you attempt to pass in values where low > high, the numbers are automatically swapped to enforce low <= high.
Definition at line 92 of file RandomStream.cpp. References modulus, and nextLong(). |
|
|
Returns a random floating point number in the range [0,max). Notice that this method can return 0.0 but cannot return any number >= max (assuming that max is a positive value).
Definition at line 78 of file RandomStream.cpp. References modulus, and nextLong(). |
|
|
Returns a random floating point number in the range (0,1). Notice that neither 0.0 nor 1.0 can be returned by this method.
Definition at line 66 of file RandomStream.cpp. References modulus, and nextLong(). Referenced by Mover::impdiff(), Mover::solve(), and Box< Float >::subdivide(). |
|
|
Returns a random integer number in the range [1,2^32-2]. Use this method if you want to get a random number as a long integer value.
Definition at line 52 of file RandomStream.cpp. References lastZ, and modulus. Referenced by next(). |
|
|
Previous random number.
Definition at line 20 of file RandomStream.h. Referenced by nextLong(), and RandomStream(). |
|
|
Constant = 2^31-1.
Definition at line 18 of file RandomStream.cpp. Referenced by next(), nextLong(), and RandomStream(). |
1.3.4