I know how you can avoid (or at least interfere with) being anally raped in prison:
Do not, under any circumstance, wipe your a** in the days leading up to your incarceration. The feces will build up and harden, ensnaring itself in your a** hair. This will create a blockage should anyone try and r*** your a**.
Of course, it could become quite unhygienic and itchy. But that’s probably better than gay r***.