Once a dog resorts to biting, it has now opened up a new behavior and depending on the result that came after the bite determines if the behavior was successful or not. If the dog is fearful and biting resulted in the “threat” backing away from them then to the dog, it worked. If in the same scenario, the “threat” kept coming and then the dog backed away, then biting had no effect. A dog is going to do what gets the results they are looking for. That is why a lot of dogs growl when threatened because it is a warning signal. If growling never works, the next action could be biting. If the dog has no outlet or place to get away, sometimes they feel biting is the only option. It is very rare for a dog to bite with no reason or precursor. In cases where they do, it is normally a predatory bite and then yes in those cases it could be unpredictable keeping that dog if you can’t manage them appropriately, especially around kids.