source: abuse/trunk/src/imlib/jrand.cpp @ 494

Last change on this file since 494 was 494, checked in by Sam Hocevar, 11 years ago

style: remove trailing spaces, fix copyright statements.

File size: 841 bytes
Line 
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 or
8 *  Jonathan Clark.
9 */
10
11#include "config.h"
12
13#include <time.h>
14#include <stdio.h>
15
16#include "jrand.h"
17
18unsigned short rtable[RAND_TABLE_SIZE];
19unsigned short rand_on=0;
20
21void jrand_init()
22{
23  // make sure random table is always the same.
24  unsigned long rseed=('F'<<24)|('U'<<16)|('C'<<8)|'K';
25  int i;
26  unsigned short *tp=rtable;
27  for (i=0; i<RAND_TABLE_SIZE; i++,tp++)
28  {
29    rseed=rseed*0x41c64e6d+12345;
30    *tp=(rseed>>16)&0xffff;
31  }
32
33  time_t t=time(NULL);         // get an original random seed now.
34  rand_on=t%RAND_TABLE_SIZE;
35}
36
Note: See TracBrowser for help on using the repository browser.