O-mikuji

O-mikuji (, , or ) are random fortunes written on strips of paper at Shinto shrines and Buddhist temples in Japan. Literally "sacred lot", these are usually received by making a small offering (generally a five-yen coin as it is considered good luck) and randomly choosing one from a box, hoping for the resulting fortune to be good. As of 2011, coin-slot machines sometimes dispense o-mikuji.
The o-mikuji predicts the person's chances of his or her hopes coming true, of finding a good match, or generally matters of health, fortune, life, etc. When the prediction is bad, it is a custom to fold up the strip of paper and attach it to a pine tree or a wall of metal wires alongside other bad fortunes in the temple or shrine grounds. A purported reason for this custom is a pun on the word for and the verb , the idea being that the bad luck will wait by the tree rather than attach itself to the bearer. In the event of the fortune being good, the bearer has two options: they can also tie it to the tree or wires so that the fortune has a greater effect or they can keep it for luck. O-mikuji are available at most shrines, and remain one of the traditional activities related to shrine-going. 
Compare perhaps the custom of writing a prayer on a specially-prepared wooden block called an "ema", which is then tied to an ad hoc scaffold.
Fortunes.
The o-mikuji is scrolled up or folded, and unrolling the piece of paper reveals the fortune written on it. It can be any of the following blessing or curse (ordered by the extent of fortune):
It then lists fortunes regarding specific aspects of one's life, which may include "any number" of the following among other possible combinations:
Relation to fortune cookies.
The random fortunes in fortune cookies may be derived from o-mikuji; this is claimed by Seiichi Kito of Fugetsu-Do, and supported by evidence that American fortune cookies derive from 19th century Kyoto crackers called tsujiura senbei.