random Generator
This commit is contained in:
parent
6efc94f199
commit
36b11122d4
@ -13,7 +13,7 @@
|
|||||||
File: ZE_ZEngine.h <br>
|
File: ZE_ZEngine.h <br>
|
||||||
Description: Header file for ZEngine class, the core of the ZEngine. <br>
|
Description: Header file for ZEngine class, the core of the ZEngine. <br>
|
||||||
Author(s): James Turk <br>
|
Author(s): James Turk <br>
|
||||||
$Id: ZE_ZEngine.h,v 1.23 2003/04/27 22:49:14 cozman Exp $<br>
|
$Id: ZE_ZEngine.h,v 1.24 2003/04/28 00:23:06 cozman Exp $<br>
|
||||||
|
|
||||||
\file ZE_ZEngine.h
|
\file ZE_ZEngine.h
|
||||||
\brief Definition file for core ZEngine class.
|
\brief Definition file for core ZEngine class.
|
||||||
@ -566,6 +566,60 @@ class ZEngine
|
|||||||
**/
|
**/
|
||||||
void FlushErrors();
|
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//
|
//Data Loading + Unloading//
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
File: ZE_ZEngine.cpp <br>
|
File: ZE_ZEngine.cpp <br>
|
||||||
Description: Implementation source file for ZEngine library main singleton class. <br>
|
Description: Implementation source file for ZEngine library main singleton class. <br>
|
||||||
Author(s): James Turk <br>
|
Author(s): James Turk <br>
|
||||||
$Id: ZE_ZEngine.cpp,v 1.37 2003/04/27 22:49:14 cozman Exp $<br>
|
$Id: ZE_ZEngine.cpp,v 1.38 2003/04/28 00:23:06 cozman Exp $<br>
|
||||||
|
|
||||||
\file ZE_ZEngine.cpp
|
\file ZE_ZEngine.cpp
|
||||||
\brief Central source file for ZEngine.
|
\brief Central source file for ZEngine.
|
||||||
@ -61,7 +61,7 @@ ZEngine::ZEngine()
|
|||||||
mLogAllErrors = true;
|
mLogAllErrors = true;
|
||||||
mErrlog = stderr;
|
mErrlog = stderr;
|
||||||
|
|
||||||
ZEngine::SeedRandom(static_cast<unsigned long>(time(NULL)));
|
SeedRandom(static_cast<unsigned long>(time(NULL)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ZEngine* ZEngine::GetInstance()
|
ZEngine* ZEngine::GetInstance()
|
||||||
|
Loading…
Reference in New Issue
Block a user