aboutsummaryrefslogtreecommitdiffstats
path: root/random.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2012-02-29 21:12:55 -0800
committerH. Peter Anvin <hpa@zytor.com>2012-02-29 21:12:55 -0800
commitc105886c048e0700de01c6ba327684b67aa0aed1 (patch)
treeec752aa3ccacb7cc32a23b051aff0f9a9ed98bf4 /random.c
parent9041bb43b4d5de67cab2a2224afcd1c40d53ec87 (diff)
downloadgrv-c105886c048e0700de01c6ba327684b67aa0aed1.tar.gz
grv-c105886c048e0700de01c6ba327684b67aa0aed1.tar.xz
grv-c105886c048e0700de01c6ba327684b67aa0aed1.zip
Clean up crap whitespace
Diffstat (limited to 'random.c')
-rw-r--r--random.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/random.c b/random.c
index e86b14d..1aac839 100644
--- a/random.c
+++ b/random.c
@@ -1,12 +1,12 @@
-/*
+/*
A C-program for MT19937, with initialization improved 2002/1/26.
Coded by Takuji Nishimura and Makoto Matsumoto.
- Before using, initialize the state by using init_genrand(seed)
+ Before using, initialize the state by using init_genrand(seed)
or init_by_array(init_key, key_length).
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
- All rights reserved.
+ All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -19,8 +19,8 @@
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- 3. The names of its contributors may not be used to endorse or promote
- products derived from this software without specific prior written
+ 3. The names of its contributors may not be used to endorse or promote
+ products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -43,7 +43,7 @@
#include <stdio.h>
-/* Period parameters */
+/* Period parameters */
#define N 624
#define M 397
#define MATRIX_A 0x9908b0dfUL /* constant vector a */
@@ -58,8 +58,8 @@ void init_genrand(unsigned long s)
{
mt[0]= s & 0xffffffffUL;
for (mti=1; mti<N; mti++) {
- mt[mti] =
- (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
+ mt[mti] =
+ (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
/* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
/* In the previous versions, MSBs of the seed affect */
/* only MSBs of the array mt[]. */
@@ -95,7 +95,7 @@ unsigned long init_key[], key_length;
if (i>=N) { mt[0] = mt[N-1]; i=1; }
}
- mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */
+ mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */
}
/* generates a random number on [0,0xffffffff]-interval */
@@ -124,7 +124,7 @@ unsigned long genrand_int32(void)
mti = 0;
}
-
+
y = mt[mti++];
/* Tempering */
@@ -145,27 +145,27 @@ long genrand_int31(void)
/* generates a random number on [0,1]-real-interval */
double genrand_real1(void)
{
- return genrand_int32()*(1.0/4294967295.0);
- /* divided by 2^32-1 */
+ return genrand_int32()*(1.0/4294967295.0);
+ /* divided by 2^32-1 */
}
/* generates a random number on [0,1)-real-interval */
double genrand_real2(void)
{
- return genrand_int32()*(1.0/4294967296.0);
+ return genrand_int32()*(1.0/4294967296.0);
/* divided by 2^32 */
}
/* generates a random number on (0,1)-real-interval */
double genrand_real3(void)
{
- return (((double)genrand_int32()) + 0.5)*(1.0/4294967296.0);
+ return (((double)genrand_int32()) + 0.5)*(1.0/4294967296.0);
/* divided by 2^32 */
}
/* generates a random number on [0,1) with 53-bit resolution*/
-double genrand_res53(void)
-{
- unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;
- return(a*67108864.0+b)*(1.0/9007199254740992.0);
-}
+double genrand_res53(void)
+{
+ unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;
+ return(a*67108864.0+b)*(1.0/9007199254740992.0);
+}