Vsauce actually did a real-life experiment on this in one of his videos, definitely worth a watch. Basically as long as the shock isn't harmful, some people can see it as some stimulation to help boredom. If I left you alone in an empty room with nothing in it but that fake pack of gum that shocks you when you pull it out, chances are you will try playing with it even though you know it'll shock you.
There's only one way to find out, we gotta lock you in a room with nothing to stimulate your mind but a single pack of gum that will shock you every time. 10 bucks you shock yourself on purpose.