Avoiding CPU race condition/cache invalidation of RNG on multi thread path tracing
You need to implement your own RNG class and not use the clib RNG implementation that shares the state across threads. What I'm using is a simple &amp; efficient multiply-with-carry RNG by George Marsaglia, that I initialize with a seed based on pixel coordinates (e.g. simple x+y*width) that I'm calculating (state per pixel instead of global state)