1#include <stdlib.h>23#undef srand4#undef rand56static unsigned long next;78void9srand(unsigned seed)10{11 next = seed;12}1314int15rand(void)16{17 /*18 * next is just an arbitrary number19 * used to generate a random number20 * which is <= RAND_MAX21 */22 next = next * 1103515245 + 12345;23 return (unsigned)(next/65536) % (RAND_MAX + 1);24}