Problem
Picking an arbitrary element from a caller-supplied set is one of the most common dummy needs in real suites ("any of the three configured currencies", "one of the states in this table"). Today OneOf exists only inside typed builders (AnyInt32.OneOf, AnyEnum.OneOf, …) — there is no top-level way to draw from a set of domain objects or arbitrary values. Every user hand-rolls the same code, and typically forgets the seeded source, silently breaking Reproducibly for that draw — the exact trap the library exists to prevent:
// Today — hand-rolled, and not seed-aware:
var currencies = new[] { eur, usd, gbp };
var currency = currencies[new Random().Next(currencies.Length)]; // ambient seed ignored!
Impact
A high-frequency, philosophy-consistent need is unserved by a library whose whole point is expressive, reproducible test data. This is the highest-leverage addition in the audit's gap analysis (a Must-Have): every consumer, most weeks.
Direction
Add top-level factories that draw from a fixed pool over the ambient source (mirrored on AnyContext):
// Proposed — seed-aware, philosophy-consistent, eagerly validated (empty pool throws):
Currency currency = Any.OneOf(eur, usd, gbp).Generate();
Order order = Any.ElementOf(existingOrders).Generate();
Any.OneOf(params T[]) and Any.ElementOf(IReadOnlyList) (an IEnumerable overload materializes once).
- Constructive: a single uniform draw from the pool; no filtering.
- Implement
ICardinalityHint (distinct count of the pool) so it composes with distinct collections for free.
- Empty pool ⇒ eager
ArgumentException (a null element in the pool is allowed — it is a valid arbitrary choice).
Acceptance criteria
Any.OneOf(a, b, c).Generate() and Any.ElementOf(list).Generate() return a member of the pool, drawing from the ambient/context source (reproducible under Reproducibly/WithSeed).
- An empty pool throws eagerly with a clear message.
- The generator advertises cardinality so
SetOf(Any.OneOf(...)).WithCount(n) gates correctly.
- Mirrored on
AnyContext; covered by the parity guards.
- Documented in the Dummies user guide with an example.
Context
Surfaced by the 2026-07-20 architecture & design audit of the standalone Dummies library (doc/handwritten/for-maintainers/audit/2026-07-20-dummies-architecture-and-design-audit.md, §10 Must-Have; branch claude/dummies-architecture-audit-cru5aq).
Filed from the Claude Code session that produced the 2026-07-20 Dummies architecture & design audit: https://claude.ai/code/session_01GvrWFVoG74xiys3oyEft1G
Problem
Picking an arbitrary element from a caller-supplied set is one of the most common dummy needs in real suites ("any of the three configured currencies", "one of the states in this table"). Today
OneOfexists only inside typed builders (AnyInt32.OneOf,AnyEnum.OneOf, …) — there is no top-level way to draw from a set of domain objects or arbitrary values. Every user hand-rolls the same code, and typically forgets the seeded source, silently breakingReproduciblyfor that draw — the exact trap the library exists to prevent:Impact
A high-frequency, philosophy-consistent need is unserved by a library whose whole point is expressive, reproducible test data. This is the highest-leverage addition in the audit's gap analysis (a Must-Have): every consumer, most weeks.
Direction
Add top-level factories that draw from a fixed pool over the ambient source (mirrored on
AnyContext):Any.OneOf(params T[])andAny.ElementOf(IReadOnlyList)(anIEnumerableoverload materializes once).ICardinalityHint(distinct count of the pool) so it composes with distinct collections for free.ArgumentException(a null element in the pool is allowed — it is a valid arbitrary choice).Acceptance criteria
Any.OneOf(a, b, c).Generate()andAny.ElementOf(list).Generate()return a member of the pool, drawing from the ambient/context source (reproducible underReproducibly/WithSeed).SetOf(Any.OneOf(...)).WithCount(n)gates correctly.AnyContext; covered by the parity guards.Context
Surfaced by the 2026-07-20 architecture & design audit of the standalone
Dummieslibrary (doc/handwritten/for-maintainers/audit/2026-07-20-dummies-architecture-and-design-audit.md, §10 Must-Have; branchclaude/dummies-architecture-audit-cru5aq).Filed from the Claude Code session that produced the 2026-07-20 Dummies architecture & design audit: https://claude.ai/code/session_01GvrWFVoG74xiys3oyEft1G