|
|
1.1 root 1: /*
2: * Copyright (c) 1980 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: */
6:
7: #ifndef lint
8: static char sccsid[] = "@(#)ranf.c 5.1 (Berkeley) 5/30/85";
9: #endif not lint
10:
11: # include <stdio.h>
12:
13: ranf(max)
14: int max;
15: {
16: register int t;
17:
18: if (max <= 0)
19: return (0);
20: t = rand() >> 5;
21: return (t % max);
22: }
23:
24:
25: double franf()
26: {
27: double t;
28: t = rand() & 077777;
29: return (t / 32767.0);
30: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.