Wisconsin’s already-fraught politics got even crazier last week when a bitterly contested, high-turnout state Supreme Court election ended in a near tie. Incumbent Justice David Prosser leads challenger JoAnne Kloppenburg by less than 0.5 percent, which means Kloppenburg has the right to a state-funded recount. We are probably headed toward a long, expensive, law-snarled process — much like Florida in 2000 or the Minnesota Senate election in 2008.

This is no way to pick a judge. And any mathematician can tell you a better, fairer and less expensive way: Flip a coin.

Choosing election winners by coin toss when there’s an exact tie is a time-honored tradition in states from Illinois to Alaska; just last Friday, a coin flip settled a school board election in Crawford County, Kan. It’s time to extend that tradition to elections so close that there’s no hope of being sure who “really won.”

It’s not quite that simple, of course. If any result within 0.5 percent triggers a coin-flip, then any result within a few hundred votes of that threshold will be just as contentious as Florida 2000 or Minnesota 2008. And it’s hardly fair to Prosser to give his opponent a 50-50 chance of winning, as if he were up by seven votes instead of 7,000.

But you can fix both problems by weighting the coin. Leading by 215 votes out of 3 million, as Norm Coleman was in his Minnesota Senate race against Al Franken? You get a 75 percent chance of winning. George W. Bush, leading by 537 Florida votes out of 6 million cast, gets a 90 percent chance. Prosser’s margin in Wisconsin is substantially bigger, so maybe Kloppenburg should be awarded a 1-in-1,000 chance of taking office. The exact formula doesn’t matter, only that the bigger your lead, the more the dice (or the computerized dice simulations) are loaded in your favor.

You might be thinking, don’t we owe it to the people to figure out exactly how many votes each candidate got? That would be nice — but it’s impossible. There are always hundreds or thousands of ballots whose markings are ambiguous or whose legality is in question. In any election bigger than town dogcatcher, there’s just no such thing as an exact vote count.

Charles Seife, another coin-flip supporter, covered the Coleman-Franken contest from a quantitative angle in his book “Proofiness.” His entertaining account exposed just how little the recount had to do with precise enumeration of votes. Much more depended on the skills of the candidates’ tussling legal teams, each of which insisted on the validity of their man’s ballots while demanding that their opponent’s questionable votes must, in the sacred name of democracy, be trashed.

Sometimes there are real reasons to think the count is biased against one candidate. In those cases, you can’t deny a trailing candidate the right to ask a court for a recount — still to be followed by a coin flip, if the vote remains close. But the new system would reduce the number of expensive recounts. As it stands, the person behind in the numbers has nothing to lose by demanding that the votes be looked at again. Who cares if you lose by 400 votes instead of 200? The coin-flip system has better incentives: Candidates have to consider the possibility of worsening their chances and will demand a recount only if they sincerely believe their voters were disproportionately uncounted.

Some will balk at the idea of choosing our leaders by chance. But that’s actually the coin flip’s most important benefit! Close elections are already determined by chance. Bad weather in the big city, a busted voting machine in an outlying town, a poorly designed ballot leading elderly Jews to vote for Pat Buchanan — any of these chance events can make the difference when the electorate is stuck at 50-50.

Close elections are random, and the sooner we face up to that, the better off we’ll be. It would save us from further iterations of the absurd spectacle that played out last week in Wisconsin. When Kloppenburg, the candidate favored by liberals, was barely ahead, the people of the state were said to be delivering a stinging rebuke to their Republican governor. When an undetected clerical error was fixed, giving the conservative Prosser his present lead, the people of Wisconsin were suddenly standing up to defend their democracy from outside socialist agitators. Choosing by coin flip helps keep us from pretending that the people have spoken for the winning candidate in a closely divided race. The people have indeed spoken. But they said, “I dunno.”

The writer is an associate professor of mathematics at the University of Wisconsin at Madison.