Civic-tech demos, election-night dashboards, and voting-app prototypes all need believable result data before any real count exists. This generator produces a fictional constituency result where the candidate vote shares always reconcile to 100 percent — the detail most ad-hoc random generators get wrong.
How it works
The tool splits the total valid votes into random integer chunks, one per candidate, guaranteeing the parts sum exactly to the total. Each candidate’s percentage is then computed and rounded, with any rounding remainder absorbed by the leading candidate so the displayed shares still total 100:
votes[i] = random integer split, sum(votes) == total
pct[i] = round(votes[i] / total * 100, 1)
winner = candidate with max(votes)
margin = winner.votes - runnerUp.votes
Candidates and parties come from neutral placeholder pools, so the output is entirely fictional and safe to publish.
Example and tips
A four-candidate contest over 48,000 votes might return a winner on 38.2 percent with a margin of 4,100 votes over the runner-up, the remaining shares filling out to exactly 100 percent. Use a larger candidate count to stress-test how your results table handles long lists, and a small total to confirm your percentage rounding still reconciles. Because everything is fictional it is fine for public marketing screenshots.