Random.c taken from Smitty's Dirty kernel