This is dave.allpole.c in view mode; [Download] [Up]
/* a modification of unix rand() to return floating point values between + and - 1. */ float randf(seed) long *seed; { *seed = ((*seed *1103515245 + 12345)>>16) & 077777; return((float)*seed/16384. - 1.); } float *brandf(seed,out,nvals) long *seed,nvals; float *out; { register long hold,temp,i,limit; limit = nvals; hold = *seed; for (i=0;i<limit;++i) { hold = (hold *505360173 + 907633385); temp = (hold >>16) & 077777; *out++ = ((float)temp/16384. - 1.); } *seed=hold; }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.