Confusion around Lambert's Cosine Law in Ray Tracing in One Weekend
It is cancelled out by the probability density function in the estimator. The pdf in their case is exactly: $\frac{\cos\theta}{\pi}$, which is in the denominator: att = albedo * cos_theta / pdf = albedo * pi. They have absorbed pi in the albedo. Note that there's an update on github to the code, since random_in_unit_sphere() actually generates a $\cos^3\theta$ distribution, they fixed it to random_on_unit_sphere() which generates a $\cos\theta$ distribution. So technically you are working with a $\cos^2\theta$ brdf here and not constant.