This is randf.c in view mode; [Download] [Up]
float randf(oldval,factor)
float *oldval, factor;
{
float crandom(),range, xlowb, upb, temp;
range = 2.0 - (2.0 * factor);
xlowb = *oldval - range;
if(xlowb < -1.) xlowb = -1;
upb = *oldval+range;
if(upb > 1) upb = 1;
temp = xlowb+(upb-xlowb)*((crandom(*oldval)+1)*.5);
*oldval=temp;
return (temp);
}
float crandom(x)
float x;
{
int n;
n=x*1048576.;
return((float)((1061*n+221589) % 1048576)/1048576.);
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.