[comp.sources.games.bugs] slot machine simulator time

mhoffman@infocenter.UUCP (Mike Hoffman) (03/22/89)

In getting "bandit" to work on our system, I ran across a
problem in the init_rand() function. Seems that our system
requires time(3) to have an argument of 0. Without it, everything
compiled fine, but when run, I got "illegal instruction - core
dumped." Changing time() to time(0) seemd to fix it.

We are running UTX/32 2.1a, Gould's 4.3BSD O/S. There is a note
in the man page that indicates that time(3) is made obsolete by
gettimeofday(2).

Here is how init_rand looks now:

void init_rand()
{
  u_32 z;

  z = time(0);		/* WAS: z = time(); */
  srandom(z);
}

Incidentally, I played a few times and lost all my money quickly,
and only had one "winner", which paid 2-1. Just bad luck? :-)

-----------------------------------------------------------------
Mike Hoffman		...!novavax!gould!mhoffman