xref: /original-bsd/games/trek/ranf.c (revision 4f485440)
1 #ifndef lint
2 static char sccsid[] = "@(#)ranf.c	4.2	(Berkeley)	05/27/83";
3 #endif not lint
4 
5 # include	<stdio.h>
6 
7 ranf(max)
8 int	max;
9 {
10 	register int	t;
11 
12 	if (max <= 0)
13 		return (0);
14 	t = rand() >> 5;
15 	return (t % max);
16 }
17 
18 
19 double franf()
20 {
21 	double		t;
22 	t = rand() & 077777;
23 	return (t / 32767.0);
24 }
25