home *** CD-ROM | disk | FTP | other *** search
- #include "RNG.h"
- #include "assert.h"
-
- //
- // The scale constant is 2^-31. It is used to scale a 31 bit
- // long to a double.
- //
-
- const double randomDoubleScaleConstant = 4.656612873077392578125e-10;
- const float randomFloatScaleConstant = 4.656612873077392578125e-10;
-
- unsigned long RNG::asLong()
- {
- assert2(0,"subClassResponsibility");
- return(0);
- }
-
- float RNG::asFloat() {
- return( (asLong() & 0x7fffffff) * randomFloatScaleConstant);
- }
-
- double RNG::asDouble() {
- return( (asLong() & 0x7fffffff) * randomDoubleScaleConstant);
- }
-