The Lambertian brdf uses random_in_unit_sphere, however this induces a cosine squared brdf rather than a Lambertian one. To correct this, one has to use random_on_unit_sphere (this can be achieved through normalize(random_in_unit_sphere)). For more information see: https://github.com/vchizhov/Derivations/blob/master/Probability%20density%20functions%20of%20the%20projected%20offset%20disk%2C%20circle%2C%20ball%2C%20and%20sphere.pdf
Note that this is a mistake in both the book and the code.