Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A simple way to generate random numbers:

Let's assume we have N positions that we want to elect MPs for. Each ballot contains an ID and a secret number between 1 and N (both numbers are physically on the ballot, but you can only see it by scratching an area). Next you define a hash function that takes a vote and returns an integer. For each 1 to N, you simply take all the ballots with the secret number and sum the hash of the votes. You can then use that value you choose choose a ballot ID.

The good thing about this solution is that you can easily re-count the votes and you end up with the same answer. And, you can place all the information in public so other parties can verify it.

Hm... Any randomness problems in this solution?



Have fun scratching off the tissue from millions of votes.

Even if it's statistically sound, it's not practical, because it doesn't scale.


There may be issues with the above solution, but scratching off tickets isn't one of them. Do you know how inefficient the process of counting votes can be now? You might think that it is impractical, or that it "doesn't scale", but they manage.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: