Function sp_npos_elections::pjr::standard_threshold[][src]

pub fn standard_threshold(
    committee_size: usize,
    weights: impl IntoIterator<Item = ExtendedBalance>
) -> ExtendedBalance
Expand description

Compute the threshold corresponding to the standard PJR property

t-PJR checks can check PJR according to an arbitrary threshold. The threshold can be any value, but the property gets stronger as the threshold gets smaller. The strongest possible t-PJR property corresponds to t == 0.

However, standard PJR is less stringent than that. This function returns the threshold whose strength corresponds to the standard PJR property.

  • committee_size is the number of winners of the election.
  • weights is an iterator of voter stakes. If the sum of stakes is already known, std::iter::once(sum_of_stakes) is appropriate here.