A man who enters a public restroom has to make a complex choice quickly. He wants to choose a urinal that maximizes his chances of maintaining privacy — that is, that minimizes the chance that someone will occupy a urinal next to him. Which choice is best?

Computer scientists Evangelos Kranakis and Danny Krizanc modeled a number of strategies: lazily choosing the closest urinal that provides privacy; tacitly cooperating in the decision with other men; maximizing one’s distance from other occupants; and making the choice randomly. Happily, their findings support the general intuition:

Our main conclusion is that when faced with the decision of what urinal to choose upon entering the men’s room, in order to maximize your privacy, you should probably choose the one furthest from the door if it is available and the one next to it is unoccupied. For a vast majority of the (what we consider) natural behaviors that men choosing urinals might follow, this choice is optimal.

Related: In 1984 Donald E. Knuth noticed that the toilet paper dispensers in Stanford’s computer science department hold two rolls of tissue, both of which are available for use. Suppose there are two sorts of people in the world, those who are disposed to draw from the larger roll and those who draw from the smaller roll, and that each user takes exactly one sheet from his favored roll. What’s the expected number of sheets remaining just after one of the two rolls has been emptied? Donald E. Knuth’s Toilet Paper Problem.

(Evangelos Kranakis and Danny Krizanc, “The Urinal Problem,” in Paolo Boldi and Luisa Gargano, eds., *Fun With Algorithms: 5th International Conference, Fun 2010, Iscia, Italy, June 2010: Proceedings*.)