fix off by .5 errors in ogl_upixelc and ogl_ulinec (d1x r1.29)
[btb/d2x.git] / maths / rand.c
1 /* $Id: rand.c,v 1.4 2004-05-12 07:31:37 btb Exp $ */
2 /*
3  *
4  * Descent random number stuff...
5  * rand has different ranges on different machines...
6  *
7  */
8
9 #ifdef HAVE_CONFIG_H
10 #include <conf.h>
11 #endif
12
13 #include <stdlib.h>
14
15 #ifdef NO_WATCOM_RAND
16
17 void d_srand(unsigned int seed)
18 {
19         srand(seed);
20 }
21
22 int d_rand()
23 {
24         return rand() & 0x7fff;
25 }
26
27 #else
28
29 static unsigned int d_rand_seed;
30
31 int d_rand()
32 {
33         return ((d_rand_seed = d_rand_seed * 0x41c64e6d + 0x3039) >> 16) & 0x7fff;
34 }
35
36 void d_srand(unsigned int seed)
37 {
38         d_rand_seed = seed;
39 }
40
41 #endif