/* * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. * * %sccs.include.redist.c% */ #ifndef lint static char sccsid[] = "@(#)ranf.c 8.1 (Berkeley) 05/31/93"; #endif /* not lint */ # include ranf(max) int max; { register int t; if (max <= 0) return (0); t = rand() >> 5; return (t % max); } double franf() { double t; t = rand() & 077777; return (t / 32767.0); }