1 #ifndef lint 2 static char sccsid[] = "@(#)ranf.c 4.1 (Berkeley) 03/23/83"; 3 #endif not lint 4 5 ranf(max) 6 int max; 7 { 8 register int t; 9 10 if (max <= 0) 11 return (0); 12 t = rand() >> 5; 13 return (t % max); 14 } 15 16 17 double franf() 18 { 19 double t; 20 t = rand() & 077777; 21 return (t / 32767.0); 22 } 23