UNPKG

ecclesia

Version:

Framework for political and electoral simulations

23 lines (20 loc) 836 B
import { RandomObjParam } from '../../utils.js'; import { Simple } from '../ballots.js'; import { Attribution, HasNSeats } from './base.js'; import '@gouvernathor/rng'; import '@gouvernathor/python/collections'; /** * Randomized attribution. * Everyone votes, then one ballot is selected at random. * (One ballot per seat to fill, and assuming there's * enough ballots that the picking is with replacement.) * * The randomization is based on the given parameters. If a RNG object * is passed, it is used without reseeding across all calls of the attribution. * If a seed is passed, the random object is reseeded * at each call of the attribution. */ declare function randomize<Party>({ nSeats, ...randomParam }: { nSeats: number; } & RandomObjParam): Attribution<Party, Simple<Party>> & HasNSeats; export { randomize };