1 /*
2  *  Abuse - dark 2D side-scrolling platform game
3  *  Copyright (c) 1995 Crack dot Com
4  *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5  *
6  *  This software was released into the Public Domain. As with most public
7  *  domain software, no warranty is made or implied by Crack dot Com, by
8  *  Jonathan Clark, or by Sam Hocevar.
9  */
10 
11 #if defined HAVE_CONFIG_H
12 #   include "config.h"
13 #endif
14 
15 #include <time.h>
16 #include <stdio.h>
17 
18 #include "jrand.h"
19 
20 unsigned short rtable[RAND_TABLE_SIZE];
21 unsigned short rand_on=0;
22 
jrand_init()23 void jrand_init()
24 {
25   // make sure random table is always the same.
26   unsigned long rseed=('F'<<24)|('U'<<16)|('C'<<8)|'K';
27   int i;
28   unsigned short *tp=rtable;
29   for (i=0; i<RAND_TABLE_SIZE; i++,tp++)
30   {
31     rseed=rseed*0x41c64e6d+12345;
32     *tp=(rseed>>16)&0xffff;
33   }
34 
35   time_t t=time(NULL);         // get an original random seed now.
36   rand_on=t%RAND_TABLE_SIZE;
37 }
38 
39