/* * r a n d . c */ /*)LIBRARY */ #ifdef DOCUMENTATION title rand Random number generator index Random number generator synopsis .s.nf long rand() extern long seed; /* Random number seed */ .s.f Description Generate a pseudorandom number. The algorithm is: seed = (69069 * seed + 1); The algorithm is based on the mth$random function in the VMS common run-time library. Note that the algorithm is prone to nonrandom sequences when considering the next pseudorandom number. Bugs #endif #ifdef M68000 #include IRAM_SECT(irm00) #endif long seed = 1234567L; #ifdef M68000 ROM_SECT(strings) #endif long rand() { seed *= 69069L; seed += 1; return (seed & 0X8FFFFFFFL); }