Convert to random()

This commit is contained in:
Andrey A. Chernov 1997-09-24 23:09:34 +00:00
parent dd126e1572
commit bcde86b03d
3 changed files with 7 additions and 9 deletions

View file

@ -45,6 +45,7 @@ static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
# include <stdio.h>
# include <sgtty.h>
# include <setjmp.h>
# include <stdlib.h>
# define PRIO 00 /* default priority */
@ -153,7 +154,6 @@ main(argc, argv)
int argc;
char **argv;
{
long vect;
/* extern FILE *f_log; */
register char opencode;
int prio;
@ -167,8 +167,7 @@ char **argv;
av = argv;
ac = argc;
av++;
time(&vect);
srand(vect);
srandomdev();
opencode = 'w';
prio = PRIO;
if (gtty(1, &argp) == 0)

View file

@ -36,22 +36,20 @@ static char sccsid[] = "@(#)ranf.c 8.1 (Berkeley) 5/31/93";
#endif /* not lint */
# include <stdio.h>
# include <stdlib.h>
ranf(max)
int max;
{
register int t;
if (max <= 0)
return (0);
t = rand() >> 5;
return (t % max);
return (random() % max);
}
double franf()
{
double t;
t = rand() & 077777;
t = random() & 077777;
return (t / 32767.0);
}

View file

@ -35,6 +35,7 @@
static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93";
#endif /* not lint */
# include <stdlib.h>
# include "trek.h"
# include "getpar.h"
@ -104,7 +105,7 @@ setup()
d = 0;
for (i = 0; Game.passwd[i]; i++)
d += Game.passwd[i] << i;
srand(d);
srandom(d);
}
Param.bases = Now.bases = ranf(6 - Game.skill) + 2;
if (Game.skill == 6)