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

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

style: remove trailing spaces, fix copyright statements.

File size: 841 bytes
RevLine 
[56]1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
[494]4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
[56]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
[2]13#include <time.h>
14#include <stdio.h>
15
[481]16#include "jrand.h"
[56]17
[2]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.
[124]24  unsigned long rseed=('F'<<24)|('U'<<16)|('C'<<8)|'K';
[2]25  int i;
26  unsigned short *tp=rtable;
[494]27  for (i=0; i<RAND_TABLE_SIZE; i++,tp++)
[2]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.