A fortune cookie is a crisp cookie usually made from flour, sugar, vanilla, and sesame seed oil with a "fortune" wrapped inside. The exact origin of fortune cookies is unclear, though various immigrant groups in California claim to have popularized them in the early 20th century, basing their recipe on a traditional Japanese cracker.
 "Sacred lots"
The fortune aspect of the cookie derives from the Japanese practice of O-mikuji (御御籤, お神籤, or おみくじ o-mikuji?), which are random fortunes written on strips of paper at Shinto shrines and Buddhist temples in Japan. The word translates as "sacred lot." 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.
Unlike fortune cookies, O-Mikuji have just as many bad fortunes. 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 pine tree (松 matsu) and the verb 'to wait' (待つ matsu), the idea being that the bad luck will wait by the tree rather than attach itself to the bearer.
 Fortune selling
Fortune cookies sell much better when they don't have negative fortunes. They also use a wide variety of vaguely Confucian sounding proverbs, just to add just a pinch of truth to the recipe.  Fortune cookies are often considered to be jokes, unlike similar fortune-predicting methods, like horoscopes.
 Other semi-random forms of divination