A-ha--you're right. (I'd never specifically tested this, but a quick
check shows that this bug is there, still in pbrt v2 even.) The issue
is that the Merseene twister code does return numbers in [0,1), but it
returns doubles, and pbrt converts them to floats. Some of the
doubles close to 1 round up to 1, and there you go.
The below fixes it in pbrt v2 (will push this up to the git version
later today):
float RNG::RandomFloat() const
{
return (RandomUInt() & 0xffffff) / float(1 << 24);
}
(The corresponding edit to genrand_real32() in pbrt v1 should fix it
there.)
Thanks for pointing this out!
-matt