rand
This commit is contained in:
parent
1ae3e8ad9d
commit
6efc94f199
@ -1,7 +1,8 @@
|
||||
ZEngine Version Log for Version 0.8.3
|
||||
$Id: changelog.txt,v 1.32 2003/04/27 21:50:43 cozman Exp $
|
||||
$Id: changelog.txt,v 1.33 2003/04/27 22:49:14 cozman Exp $
|
||||
|
||||
0.8.3
|
||||
-Added Random Number generation to the ZEngine singleton.
|
||||
-Fixed project files for people who don't want to add ZEngine to their path.
|
||||
-Altered layout of some of the header files to hopefully be more readable.
|
||||
-Fixed minor bugs in ZImage, allowing Gewi to work properly.
|
||||
|
@ -13,7 +13,7 @@
|
||||
File: ZE_ZEngine.h <br>
|
||||
Description: Header file for ZEngine class, the core of the ZEngine. <br>
|
||||
Author(s): James Turk <br>
|
||||
$Id: ZE_ZEngine.h,v 1.22 2003/04/27 21:50:47 cozman Exp $<br>
|
||||
$Id: ZE_ZEngine.h,v 1.23 2003/04/27 22:49:14 cozman Exp $<br>
|
||||
|
||||
\file ZE_ZEngine.h
|
||||
\brief Definition file for core ZEngine class.
|
||||
@ -566,60 +566,6 @@ 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//
|
||||
////////////////////////////
|
||||
|
@ -13,7 +13,7 @@
|
||||
File: ZE_ZEngine.cpp <br>
|
||||
Description: Implementation source file for ZEngine library main singleton class. <br>
|
||||
Author(s): James Turk <br>
|
||||
$Id: ZE_ZEngine.cpp,v 1.36 2003/04/27 22:05:25 cozman Exp $<br>
|
||||
$Id: ZE_ZEngine.cpp,v 1.37 2003/04/27 22:49:14 cozman Exp $<br>
|
||||
|
||||
\file ZE_ZEngine.cpp
|
||||
\brief Central source file for ZEngine.
|
||||
@ -645,7 +645,7 @@ unsigned long ZEngine::RandLong(unsigned long max)
|
||||
|
||||
long ZEngine::RandLong(long min, long max)
|
||||
{
|
||||
return min + genrand_int32()%(max-min);
|
||||
return min + genrand_int32()%(max-min+1);
|
||||
}
|
||||
|
||||
double ZEngine::RandDouble()
|
||||
|
@ -122,6 +122,10 @@ SOURCE=..\src\ZE_ZTimer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\external\mt19937ar.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\external\physfsrwops.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
@ -194,6 +198,10 @@ SOURCE=..\include\ZEngine.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\external\mt19937ar.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\external\physfsrwops.h
|
||||
# End Source File
|
||||
# End Group
|
||||
|
Loading…
Reference in New Issue
Block a user