Expand description
A rust implementation of the Sainte-Laguë (also known as Webster or Schepers) method. Parliament seat allocation algorithm used in multiple countries such as Germany, Latvia, New Zealand etc…
Attention: Since some countries (like Latvia or Norway) use a modification of the algorithm instead of this vanilla version, you should check your country’s electoral legislature. Furthermore, I don’t take any responsibility for the accuracy of the calculated numbers, even though I’m pretty confident with my implementation.
Enums§
- Distribution
Error - Possible error cases of
distribute
.
Functions§
- distribute
- Calculate the Sainte-Laguë distribution for the given
votes
and a parliament of sizeseat_count
. Note that while votes are usually restricted to integers in normal elections, this function expects floating point numbers, allowing additional use cases.