1/* 2 * Copied from the ANSI C standard 4.10.2.2. 3 */ 4#include "db_config.h" 5 6#include "db_int.h" 7 8/* 9 * rand, srand -- 10 * 11 * PUBLIC: #ifndef HAVE_RAND 12 * PUBLIC: int rand __P((void)); 13 * PUBLIC: void srand __P((unsigned int)); 14 * PUBLIC: #endif 15 */ 16int rand(void) /* RAND_MAX assumed to be 32767 */ 17{ 18 DB_GLOBAL(rand_next) = DB_GLOBAL(rand_next) * 1103515245 + 12345; 19 return (unsigned int) (DB_GLOBAL(rand_next)/65536) % 32768; 20} 21 22void srand(unsigned int seed) 23{ 24 DB_GLOBAL(rand_next) = seed; 25} 26