/* Random48c.h - CSC 601 - Fall 2002 - Kirby * * A common 48-bit random number generator. * See http://www.opengroup.org/onlinepubs/007908799/xsh/drand48.html. */ static unsigned int _hi, _lo ; void srand48( unsigned int seed ) { _hi= seed ; _lo= 0x330E ; } int rand48() { _hi = (_hi * 0xDEECE66D) + (_lo * 0x5DEEC) ; _lo = _lo * 0xE66D + 0xB ; _hi = _hi + (_lo >> 16) ; _lo = _lo & 0xFFFF ; return (_hi >> 1) ; }