1 2 3 4 5 6
#include <stdlib.h> int rand_r(unsigned *seed) { return (*seed = *seed * 1103515245 + 12345)/2; }