/*****************************************
  xjump version 2

  misc.c   雑処理

  (C) July 16, 1997  ROYALPANDA
*****************************************/

#include<stdio.h>

static long Seed;


/* 乱数 */

int rnd( int range )
{
  long tmp,hi,lo;

  hi = Seed / 127773;
  lo = Seed % 127773;
  Seed = 16807 * lo - 2836 * hi;
  if( Seed <= 0 )
    Seed += 0x7fffffff;

  return Seed % range;
}


/* 乱数初期化 */

void srnd( int seed )
{
  Seed = seed;
}
