]> icculus.org git repositories - btb/d2x.git/blob - maths/rand.c
use the orientation parameter of g3_draw_bitmap
[btb/d2x.git] / maths / rand.c
1 /*
2  *
3  * Descent random number stuff...
4  * rand has different ranges on different machines...
5  *
6  */
7
8 #ifdef HAVE_CONFIG_H
9 #include <conf.h>
10 #endif
11
12 #include <stdlib.h>
13
14 #ifdef NO_WATCOM_RAND
15
16 void d_srand(unsigned int seed)
17 {
18         srand(seed);
19 }
20
21 int d_rand()
22 {
23         return rand() & 0x7fff;
24 }
25
26 #else
27
28 static unsigned int d_rand_seed;
29
30 int d_rand()
31 {
32         return ((d_rand_seed = d_rand_seed * 0x41c64e6d + 0x3039) >> 16) & 0x7fff;
33 }
34
35 void d_srand(unsigned int seed)
36 {
37         d_rand_seed = seed;
38 }
39
40 #endif