What's the purpose of augmenting an image with a random "gradient"?
It's not generating a gradient in the computer vision / image processing sense but in the graphics community sense. For example, if you use Gimp's gradient tool you will fill images with values interpolated between 2 ends.

My guess regarding the augmentation is that the author is trying to learn invariance to some shading effects (eg., when the sun makes an angle with object in the scene and you can see walls or other surfaces becoming gradually darker).