diff --git a/include/ZE_ZEngine.h b/include/ZE_ZEngine.h index 78bb445..6c53b58 100644 --- a/include/ZE_ZEngine.h +++ b/include/ZE_ZEngine.h @@ -13,7 +13,7 @@ File: ZE_ZEngine.h
Description: Header file for ZEngine class, the core of the ZEngine.
Author(s): James Turk
-$Id: ZE_ZEngine.h,v 1.23 2003/04/27 22:49:14 cozman Exp $
+$Id: ZE_ZEngine.h,v 1.24 2003/04/28 00:23:06 cozman Exp $
\file ZE_ZEngine.h \brief Definition file for core ZEngine class. @@ -566,6 +566,60 @@ class ZEngine **/ void FlushErrors(); + //////////////////////////// + //Random Number Generation// + //////////////////////////// + /*! + \brief Seed random number generator. + + Reseed Mersenne Twister (MT19937) random number generator. NOTE: Generator is initialized upon creation of ZEngine using time. + (Faster and more random than rand(), see src/external/mt19937ar.c) + \since 0.8.3 + \param seed Seed for random sequence. + **/ + void SeedRandom(unsigned long seed); + + /*! + \brief Obtain random integer [0,max). + + Obtain random long l where 0 <= l < max. + \since 0.8.3 + \param max Limit for random number. + \return Random unsigned long. + **/ + unsigned long RandLong(unsigned long max); + + /*! + \brief Obtain random integer [min,max]. + + Obtain random long l where min <= l <= max. + \since 0.8.3 + \param min Lower limit for random number. + \param max Upper limit for random number. + \return Random long. + **/ + long RandLong(long min, long max); + + /*! + \brief Obtain random double [0,1). + + Obtain random double d where 0 <= d < 1. + \since 0.8.3 + \return Random double [0,1). + **/ + double RandDouble(); + + /*! + \brief Obtain random double [min,max]. + + Obtain random double d where min <= d <= max. + \since 0.8.3 + \param min Lower limit for random number. + \param max Upper limit for random number. + \return Random double [min,max]. + **/ + double RandDouble(double min, double max); + //////////////////////////// //Data Loading + Unloading// //////////////////////////// diff --git a/src/ZE_ZEngine.cpp b/src/ZE_ZEngine.cpp index 8652dd6..971c074 100644 --- a/src/ZE_ZEngine.cpp +++ b/src/ZE_ZEngine.cpp @@ -13,7 +13,7 @@ File: ZE_ZEngine.cpp
Description: Implementation source file for ZEngine library main singleton class.
Author(s): James Turk
-$Id: ZE_ZEngine.cpp,v 1.37 2003/04/27 22:49:14 cozman Exp $
+$Id: ZE_ZEngine.cpp,v 1.38 2003/04/28 00:23:06 cozman Exp $
\file ZE_ZEngine.cpp \brief Central source file for ZEngine. @@ -61,7 +61,7 @@ ZEngine::ZEngine() mLogAllErrors = true; mErrlog = stderr; - ZEngine::SeedRandom(static_cast(time(NULL))); + SeedRandom(static_cast(time(NULL))); } ZEngine* ZEngine::GetInstance()