- Edited
This one is meant in jest. It works 50% of the time. The question is, using probabilistic methods, is it possible to do better than 50%?
import random
def f(n):
return n * random.choice((-1,1))