[10556] Add frand function for random floats with min/max, similar to urand

This commit is contained in:
DasBlub 2010-09-29 22:04:44 +02:00
parent 802e01a494
commit 7d7bb3cfe6
3 changed files with 9 additions and 1 deletions

View file

@ -36,6 +36,11 @@ uint32 urand (uint32 min, uint32 max)
return mtRand->randInt (max - min) + min;
}
float frand (float min, float max)
{
return mtRand->randExc (max - min) + min;
}
int32 rand32 ()
{
return mtRand->randInt ();

View file

@ -49,6 +49,9 @@ MANGOS_DLL_SPEC int32 irand(int32 min, int32 max);
* between max and min should be less than RAND32_MAX. */
MANGOS_DLL_SPEC uint32 urand(uint32 min, uint32 max);
/* Return a random number in the range min..max (inclusive). */
MANGOS_DLL_SPEC float frand(float min, float max);
/* Return a random number in the range 0 .. RAND32_MAX. */
MANGOS_DLL_SPEC int32 rand32();

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10555"
#define REVISION_NR "10556"
#endif // __REVISION_NR_H__