diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2013-02-12 20:18:58 -0800 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2013-02-12 21:09:59 -0800 |
commit | b17b9021ecf9b16c265d0a6b60faa761b34eae35 (patch) | |
tree | e8192de5b2458864f0f5ce5edd0e1ccf5605c644 /src/common/mt_rand.hpp | |
parent | 80e36aa669274637bcd5956fbf4020dba1d4739c (diff) | |
download | tmwa-b17b9021ecf9b16c265d0a6b60faa761b34eae35.tar.gz tmwa-b17b9021ecf9b16c265d0a6b60faa761b34eae35.tar.bz2 tmwa-b17b9021ecf9b16c265d0a6b60faa761b34eae35.tar.xz tmwa-b17b9021ecf9b16c265d0a6b60faa761b34eae35.zip |
Replace mt_rand with <random>
Also add some utility methods and classes.
Diffstat (limited to 'src/common/mt_rand.hpp')
-rw-r--r-- | src/common/mt_rand.hpp | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/src/common/mt_rand.hpp b/src/common/mt_rand.hpp deleted file mode 100644 index ae5986b..0000000 --- a/src/common/mt_rand.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef MT_RAND_HPP -#define MT_RAND_HPP - -# include "sanity.hpp" - -/// Initialize the generator (called automatically with time() if you don't) -void mt_seed(uint32_t seed); -/// Get a random number -uint32_t mt_random(void); - -/** - * ModuloRand and ModuloPlusRand - * These macros are used to replace the vast number of calls to rand()%mod - * TODO eliminate the rest of the calls to rand() - * MRAND(10) returns 0..9 - * MPRAND(5,10) returns 5..14 - */ -// The cast is essential because the result is sometimes -// compared with a possibly negative number. -// Because it's using modulus, high numbers shouldn't happen anyway. -# define MRAND(mod) ((int)(mt_random() % (mod))) -# define MPRAND(add, mod) ((add) + MRAND(mod)) - -#endif // MT_RAND_HPP |