From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03302.html | 384 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 384 insertions(+) create mode 100644 docs/doxygen/nel/a03302.html (limited to 'docs/doxygen/nel/a03302.html') diff --git a/docs/doxygen/nel/a03302.html b/docs/doxygen/nel/a03302.html new file mode 100644 index 00000000..f59c52f9 --- /dev/null +++ b/docs/doxygen/nel/a03302.html @@ -0,0 +1,384 @@ + + +NeL: NLMISC::CRandom class Reference + + + +
+

NLMISC::CRandom Class Reference

#include <random.h> +

+


Detailed Description

+A simple, os-independant random generator.
Author:
Nicolas Vizerie

+Nevrax France

+
Date:
2002
+ +

+ +

+Definition at line 38 of file random.h. + + + + + + + + + + + + + + + + + + + + + + +

Public Types

enum  { RandMax = 0x7fff + }

Public Member Functions

 CRandom ()
float frand (double mod=1.0f)
float frandPlusMinus (double mod=1.0)
sint32 rand (uint16 mod)
sint32 rand ()
sint32 randPlusMinus (uint16 mod)
void srand (sint32 seed)

Private Attributes

sint32 _Seed
+


Member Enumeration Documentation

+

+ + + + +
+ + +
anonymous enum +
+
+ + + + + +
+   + + +

+

Enumeration values:
+ + +
RandMax  +
+
+ +

+Definition at line 42 of file random.h. +

+

00042 { RandMax = 0x7fff };
+
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NLMISC::CRandom::CRandom  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 64 of file random.h. +

+

00064                         : _Seed(1)
+00065 {
+00066 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
float NLMISC::CRandom::frand double  mod = 1.0f  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 90 of file random.h. +

+References r, rand(), and RandMax. +

+Referenced by frandPlusMinus(). +

+

00091 {
+00092         double  r = (double) rand();
+00093         r /= (double) RandMax;
+00094         return (float)(r * mod);        
+00095 }
+
+

+ + + + +
+ + + + + + + + + + +
float NLMISC::CRandom::frandPlusMinus double  mod = 1.0  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 98 of file random.h. +

+References frand(). +

+

00099 {
+00100         return frand(2*mod)-(float)mod;
+00101 }
+
+

+ + + + +
+ + + + + + + + + + +
sint32 NLMISC::CRandom::rand uint16  mod  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 76 of file random.h. +

+References rand(), RandMax, sint32, and uint16. +

+

00077 {
+00078         sint32 m=mod;
+00079         return rand()*(m+1)/(sint32(RandMax)+1);
+00080 }
+
+

+ + + + +
+ + + + + + + + + +
sint32 NLMISC::CRandom::rand  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 70 of file random.h. +

+References _Seed, RandMax, and sint32. +

+Referenced by NL3D::CZoneLighter::attenuation(), frand(), rand(), and randPlusMinus(). +

+

00071 {
+00072         return ((_Seed = _Seed * 214013L + 2531011L) >> 16) & RandMax;  
+00073 }
+
+

+ + + + +
+ + + + + + + + + + +
sint32 NLMISC::CRandom::randPlusMinus uint16  mod  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 83 of file random.h. +

+References rand(), RandMax, sint32, and uint16. +

+

00084 {
+00085         sint32 m=mod;
+00086         return m - rand()*(2*m+1)/(sint32(RandMax)+1);
+00087 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CRandom::srand sint32  seed  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 104 of file random.h. +

+References _Seed, and sint32. +

+

00105 {
+00106         _Seed = seed;
+00107 }
+
+


Field Documentation

+

+ + + + +
+ + +
sint32 NLMISC::CRandom::_Seed [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 59 of file random.h. +

+Referenced by rand(), and srand().

+


The documentation for this class was generated from the following file: +
Generated on Tue Mar 16 13:30:58 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1