/*
   Copyright (C) 2004 by James Gregory
   Part of the GalaxyHack project
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License.
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY.
 
   See the COPYING file for more details.
*/

#include "Random.h"
#include "Globals.h"

static unsigned long next = 1;

int Random() {
    /* RAND_MAX assumed to be 32767 */ 
    next = next * 1103515245 + 12345; 
    return((unsigned)(next/65536) % 32768); 
} 

void SeedRandom(unsigned seed) {
	next = seed; 
}
