1- /*
1+ /*
22 * The Mersenne Twister pseudo-random number generator (PRNG)
33 *
44 * This is an implementation of fast PRNG called MT19937,
1414 *
1515 * Written by Christian Stigen Larsen
1616 * http://csl.sublevel3.org
17- *
17+ *
1818 * Distributed under the modified BSD license.
1919 *
2020 * 2012-01-11
@@ -40,7 +40,7 @@ static unsigned index = 0;
4040#define L31 (x ) (0x7FFFFFFF & x) // 31 Least Significant Bits
4141#define ODD (x ) (x & 1 ) // Check if number is odd
4242
43- #define UINT32_MAX std::numeric_limits<uint32_t >::max()
43+ #define MD_UINT32_MAX std::numeric_limits<uint32_t >::max()
4444
4545static inline void generate_numbers ()
4646{
@@ -170,10 +170,10 @@ extern "C" int mt_rand()
170170 * PORTABILITY WARNING:
171171 *
172172 * rand_u32() uses all 32-bits for the pseudo-random number,
173- * but rand() must return a number from 0 ... RAND_MAX .
173+ * but rand() must return a number from 0 ... MD_RAND_MAX .
174174 *
175175 * We'll just assume that rand() only uses 31 bits worth of
176- * data, and that we're on a two's complement system.
176+ * data, and that we're on a two's complement system.
177177 *
178178 * So, to output an integer compatible with rand(), we have
179179 * two options: Either mask off the highest (32nd) bit, or
@@ -191,32 +191,32 @@ extern "C" void mt_srand(unsigned value)
191191
192192extern " C" float randf_cc ()
193193{
194- return static_cast <float >(rand_u32 ())/UINT32_MAX ;
194+ return static_cast <float >(rand_u32 ())/MD_UINT32_MAX ;
195195}
196196
197197extern " C" float randf_co ()
198198{
199- return static_cast <float >(rand_u32 ())/(UINT32_MAX +1 .0f );
199+ return static_cast <float >(rand_u32 ())/(MD_UINT32_MAX +1 .0f );
200200}
201201
202202extern " C" float randf_oo ()
203203{
204- return (static_cast <float >(rand_u32 ())+0 .5f )/(UINT32_MAX +1 .0f );
204+ return (static_cast <float >(rand_u32 ())+0 .5f )/(MD_UINT32_MAX +1 .0f );
205205}
206206
207207extern " C" double randd_cc ()
208208{
209- return static_cast <double >(rand_u32 ())/UINT32_MAX ;
209+ return static_cast <double >(rand_u32 ())/MD_UINT32_MAX ;
210210}
211211
212212extern " C" double randd_co ()
213213{
214- return static_cast <double >(rand_u32 ())/(UINT32_MAX +1.0 );
214+ return static_cast <double >(rand_u32 ())/(MD_UINT32_MAX +1.0 );
215215}
216216
217217extern " C" double randd_oo ()
218218{
219- return (static_cast <double >(rand_u32 ())+0.5 )/(UINT32_MAX +1.0 );
219+ return (static_cast <double >(rand_u32 ())+0.5 )/(MD_UINT32_MAX +1.0 );
220220}
221221
222222extern " C" uint64_t rand_u64 ()
0 commit comments