As mentioned, growling is a distance-increasing behavior, and its function is often to increase space or stop an interaction that the dog finds uncomfortable. In the case of a dog that growls upon a ...
"My dog, specifically at nighttime, will randomly growl... I was just petting her gently, and she growled. Other nights, we will just simply move, and she will be lying in her crate, and she'll growl.