Sorry. (Not sorry.)
The author of the linked article did a meta study of research into animal (mostly primate) masturbation, and posited some theories on how it could have evolved as an aid to procreation and sexual health.
So onanism isn’t a sin. But expect the religious right to start protesting zoos if this gets enough coverage.