Quote from TheCakeisAlive
It's actually a random rotation based on distance
ಠ_ಠ No. I posted (quite detailed) specifics about what potions witches throw from the wiki for a reason. If you're at least 8 blocks away, they throw a potion of slowness. If you have 8+ health and are not poisoned, they poison you. if You're within 3 blocks of them and do not have weakness, they throw weakness ~25% of the time.
If they don't meet the conditions to throw a specific potion, they pelt you with damage poisons. They aren't random, the Witch actually has really sophisticated combat AI compared to most other mobs. If you happen to be more than 3 blocks and less than 8 blocks away, Witches also go into Nuke The Player mode, because their programming tells them not to throw weakness or slowness potions- meaning they'll start with poison, wait for you to go down to 7.5 or less hearts, and then use nothing but damage potions.
When fighting close-quarters with witches, I found it to be worthwhile to smack all of them once, burst the nearest witch down, and then repeat the process. Causing every witch you're fighting to stop chucking potions everywhere for a couple seconds is worth adding to the lifespan of the witch you're killing at that exact moment. That can be tricky business though, I'd only suggest engaging CQC with witches if you can't pick them off from range for whatever reason.