aboutsummaryrefslogtreecommitdiff
path: root/src/port/rand.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/port/rand.c')
-rw-r--r--src/port/rand.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/port/rand.c b/src/port/rand.c
index 7fc3094decb..ca1d621fca7 100644
--- a/src/port/rand.c
+++ b/src/port/rand.c
@@ -19,13 +19,13 @@
* of any kind. I shall in no event be liable for anything that happens
* to anyone/anything when using this software.
*/
-#define RAND48_SEED_0 (0x330e)
-#define RAND48_SEED_1 (0xabcd)
-#define RAND48_SEED_2 (0x1234)
-#define RAND48_MULT_0 (0xe66d)
-#define RAND48_MULT_1 (0xdeec)
-#define RAND48_MULT_2 (0x0005)
-#define RAND48_ADD (0x000b)
+#define RAND48_SEED_0 (0x330e)
+#define RAND48_SEED_1 (0xabcd)
+#define RAND48_SEED_2 (0x1234)
+#define RAND48_MULT_0 (0xe66d)
+#define RAND48_MULT_1 (0xdeec)
+#define RAND48_MULT_2 (0x0005)
+#define RAND48_ADD (0x000b)
unsigned short _rand48_seed[3] = {
RAND48_SEED_0,
@@ -46,11 +46,11 @@ _dorand48(unsigned short xseed[3])
unsigned short temp[2];
accu = (unsigned long) _rand48_mult[0] * (unsigned long) xseed[0] +
- (unsigned long) _rand48_add;
+ (unsigned long) _rand48_add;
temp[0] = (unsigned short) accu; /* lower 16 bits */
accu >>= sizeof(unsigned short) * 8;
accu += (unsigned long) _rand48_mult[0] * (unsigned long) xseed[1] +
- (unsigned long) _rand48_mult[1] * (unsigned long) xseed[0];
+ (unsigned long) _rand48_mult[1] * (unsigned long) xseed[0];
temp[1] = (unsigned short) accu; /* middle 16 bits */
accu >>= sizeof(unsigned short) * 8;
accu += _rand48_mult[0] * xseed[2] + _rand48_mult[1] * xseed[1] + _rand48_mult[2] * xseed[0];
@@ -63,7 +63,7 @@ long
lrand48(void)
{
_dorand48(_rand48_seed);
- return ((long) _rand48_seed[2] << 15) + ((long) _rand48_seed[1] >1);
+ return ((long) _rand48_seed[2] << 15) + ((long) _rand48_seed[1] > 1);
}
void
@@ -71,7 +71,7 @@ srand48(long seed)
{
_rand48_seed[0] = RAND48_SEED_0;
_rand48_seed[1] = (unsigned short) seed;
- _rand48_seed[2] = (unsigned short) (seed >16);
+ _rand48_seed[2] = (unsigned short) (seed > 16);
_rand48_mult[0] = RAND48_MULT_0;
_rand48_mult[1] = RAND48_MULT_1;
_rand48_mult[2] = RAND48_MULT_2;