referrerpolicy=no-referrer-when-downgrade
pub fn generate_random_npos_inputs(
    candidate_count: usize,
    voter_count: usize,
    rng: impl Rng,
) -> (usize, Vec<u64>, Vec<(u64, VoteWeight, Vec<u64>)>)
Expand description

Generate a set of inputs suitable for fuzzing an election algorithm

Given parameters governing how many candidates and voters should exist, generates a voting scenario suitable for fuzz-testing an election algorithm.

The returned candidate list is sorted. This sorting property should not affect the result of the calculation.

The returned voters list is sorted. This enables binary searching for a particular voter by account id. This sorting property should not affect the results of the calculation.

Each voter’s selection of candidates to vote for is sorted.

Note that this does not generate balancing parameters.