IN the opening act of Tom Stoppard’s play “Rosencrantz and Guildenstern Are Dead,” the two characters are passing the time by betting on the outcome of a coin toss. Guildenstern retrieves a gold piece from his bag and flips it in the air. “Heads,” Rosencrantz announces as he adds the coin to his growing collection.

Guil, as he’s called for short, flips another coin. Heads. And another. Heads again. Seventy-seven heads later, as his satchel becomes emptier and emptier, he wonders: Has there been a breakdown in the laws of probability? Are supernatural forces intervening? Have he and his friend become stuck in time, reliving the same random coin flip again and again?

Eighty-five heads, 89… Surely his losing streak is about to end.

Psychologists who study how the human mind responds to randomness call this the gambler’s fallacy — the belief that on some cosmic plane a run of bad luck creates an imbalance that must ultimately be corrected, a pressure that must be relieved. After several bad rolls, surely the dice are primed to land in a more advantageous way.

The opposite of that is the hot-hand fallacy — the belief that winning streaks, whether in basketball or coin tossing, have a tendency to continue, as if propelled by their own momentum. Both misconceptions are reflections of the brain’s wired-in rejection of the power that randomness holds over our lives. Look deep enough, we instinctively believe, and we may uncover a hidden order.