/** * Hamilton's largest-remainder method for distributing a total count * across a set of values according to given percentages. * * Use case: given `count = 1_000_000` and the rule "60% men, 40% women", * produce exactly 600 000 men and 400 000 women cells. When percentages * don't divide `count` evenly, the unallocated remainder is distributed * to the values with the largest fractional part first; ties are broken * randomly via the supplied PRNG. * * Ported from the 2022-2024 TDC prototype's `Generator.allocateDataByPercentage`. * Bit-identical on the same (count, values, percents, prng-state) input * — see the golden vectors in the companion test file. Any future port * (Python, Java) MUST reproduce these outputs exactly. * * Both the tie-breaking and the final Fisher-Yates shuffle consume from * the supplied PRNG, in that order. The returned array is the * materialized, shuffled sequence. * * Full spec: docs/vision/02-sequences.md */ export interface DistributeOptions { /** Total number of cells to materialize. Must be > 0. */ readonly count: number; /** Distinct values to distribute across the cells. */ readonly values: readonly T[]; /** * Percentages for each value in `values`; length MUST equal values.length. * Values are expected to be non-negative and to sum to 100 (modulo * floating-point noise). No bounds check is performed here. */ readonly percents: readonly number[]; /** PRNG; consumed for tie-breaking and the final shuffle. */ readonly prng: () => number; } /** * Distribute `count` cells across `values` in the proportions given by * `percents`, and return the materialized, shuffled sequence. */ export declare function distributeByPercent(opts: DistributeOptions): T[]; /** * Compute how many cells each value in `percents` should receive. * Exported separately so that higher-level sequence engine code can * consume the raw counts without forcing materialization + shuffle. */ export declare function computeCountsPerValue(count: number, percents: readonly number[], prng: () => number): number[]; //# sourceMappingURL=hamilton.d.ts.map