summaryrefslogtreecommitdiff
path: root/src/common/mt_rand.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2012-12-13 16:25:50 -0800
committerBen Longbons <b.r.longbons@gmail.com>2012-12-14 16:18:22 -0800
commit069f39e8a1ebee3e4a4ce8302d0099842876782b (patch)
tree57d8de5f57d65878f8ef560e2884b9dee08e9323 /src/common/mt_rand.cpp
parentf9563edf69f083287630f4b17db70d97524196d6 (diff)
downloadtmwa-069f39e8a1ebee3e4a4ce8302d0099842876782b.tar.gz
tmwa-069f39e8a1ebee3e4a4ce8302d0099842876782b.tar.bz2
tmwa-069f39e8a1ebee3e4a4ce8302d0099842876782b.tar.xz
tmwa-069f39e8a1ebee3e4a4ce8302d0099842876782b.zip
Some formatting fixes before I go insane
Also delete the French translation from ladmin.
Diffstat (limited to 'src/common/mt_rand.cpp')
-rw-r--r--src/common/mt_rand.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/common/mt_rand.cpp b/src/common/mt_rand.cpp
index 676eca1..91ae2e4 100644
--- a/src/common/mt_rand.cpp
+++ b/src/common/mt_rand.cpp
@@ -61,7 +61,7 @@ static uint32_t state[N+1]; // state vector the +1 is needed due to the coding
static uint32_t *next; // next random value is computed from here
static int left = -1; // can *next++ this many times before reloading
-void mt_seed (uint32_t seed)
+void mt_seed(uint32_t seed)
{
uint32_t x = seed | 1U;
uint32_t *s = state;
@@ -71,11 +71,11 @@ void mt_seed (uint32_t seed)
}
static
-void mt_reload (void)
+void mt_reload(void)
{
// if mt_seed has never been called
if (left < -1)
- mt_seed (time (NULL));
+ mt_seed(time(NULL));
// conceptually, these are indices into the state that wrap
uint32_t *p0 = state;
@@ -87,27 +87,27 @@ void mt_reload (void)
// regenerate the lower N-M elements of the state
for (int j = N-M+1; --j != 0; s0 = s1, s1 = *p2++)
- *p0++ = *pM++ ^ (mixBits (s0, s1) >> 1) ^ (loBit (s1) ? K : 0U);
+ *p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
pM = state;
// regenerate the next M-1 elements of the state
// note that s1 is set to state[N] at the end, but discarded
for (int j = M; --j != 0; s0 = s1, s1 = *p2++)
- *p0++ = *pM++ ^ (mixBits (s0, s1) >> 1) ^ (loBit (s1) ? K : 0U);
+ *p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
// regenerate the last 1 element of the state
s1 = state[0];
- *p0 = *pM ^ (mixBits (s0, s1) >> 1) ^ (loBit (s1) ? K : 0U);
+ *p0 = *pM ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
// ready for the normal mt_random algorithm
left = N;
next = state;
}
-uint32_t mt_random (void)
+uint32_t mt_random(void)
{
if (--left < 0)
- mt_reload ();
+ mt_reload();
uint32_t y = *next++;
y ^= (y >> 11);