--- ray/src/rt/ambcomp.c 1991/06/13 12:00:29 1.7 +++ ray/src/rt/ambcomp.c 1991/07/11 16:39:00 1.9 @@ -72,9 +72,9 @@ RAY *r; hlist[1] = dp->t; hlist[2] = dp->p; hlist[3] = 0; - zd = sqrt((dp->t+urand(ilhash(hlist,4)+dp->n))/h->nt); + zd = sqrt((dp->t+urand(urind(ilhash(hlist,4),dp->n)))/h->nt); hlist[3] = 1; - phi = 2.0*PI * (dp->p+urand(ilhash(hlist,4)+dp->n))/h->np; + phi = 2.0*PI * (dp->p+urand(urind(ilhash(hlist,4),dp->n)))/h->np; xd = cos(phi) * zd; yd = sin(phi) * zd; zd = sqrt(1.0 - zd*zd); @@ -86,7 +86,7 @@ RAY *r; rayvalue(&ar); ndims--; addcolor(dp->v, ar.rcol); - if (ar.rt < FHUGE) + if (ar.rt > FTINY && ar.rt < FHUGE) dp->r += 1.0/ar.rt; /* (re)initialize error */ if (dp->n++) {