This function is "add noise", not remove Basically, the first and most important fix is there to give better control on the amount of noise you add, while the second one is there to fix a minor bug in the coloration of the noise.
(and yes, there is a very tiny performance improvement, but that's not really the point)