new doc.mk; document numbering changes for 4.4BSD
[unix-history] / usr / src / games / trek / ranf.c
CommitLineData
b6f0a7e4 1/*
4c3ad851
KB
2 * Copyright (c) 1980, 1993
3 * The Regents of the University of California. All rights reserved.
e9fb6bea 4 *
b2e7427f 5 * %sccs.include.redist.c%
b6f0a7e4
DF
6 */
7
db247e8f 8#ifndef lint
4c3ad851 9static char sccsid[] = "@(#)ranf.c 8.1 (Berkeley) %G%";
e9fb6bea 10#endif /* not lint */
db247e8f 11
06d69904
KL
12# include <stdio.h>
13
db247e8f
KM
14ranf(max)
15int max;
16{
17 register int t;
18
19 if (max <= 0)
20 return (0);
21 t = rand() >> 5;
22 return (t % max);
23}
24
25
26double franf()
27{
28 double t;
29 t = rand() & 077777;
30 return (t / 32767.0);
31}