Array expression containing the collection to sample from.
Must be an expression that evaluates to an array containing more elements than the requested sample count to enable meaningful random selection. Elements should be valid business entities appropriate for the sampling context.
Can reference captured data from previous API operations, array literals, or other expressions that produce collections suitable for sampling.
Examples:
The collection size should exceed the count
parameter to ensure
meaningful random sampling without duplication.
Business context: Typically represents pools of available entities like product catalogs, user lists, or option sets that need subset selection for API operations.
Expression determining how many elements to select from the collection.
Must be an expression that evaluates to a number representing the desired sample size. Should be less than or equal to the collection size to avoid sampling errors. Should represent realistic business requirements for the sampling scenario.
⚠️ CRITICAL AI RESTRICTION: This MUST be an AST expression, NOT a raw number! ⚠️
❌ WRONG: 3 (raw number) ✅ CORRECT: INumericLiteral with value: 3 (AST expression) ✅ CORRECT: IIntegerRandom for variable count (AST expression)
Examples:
INumericLiteral(3)
for exactly 3 featured productsIIntegerRandom({ minimum: 2, maximum: 5 })
for variable selectionIIdentifier("sampleSize")
for dynamic count from captured dataBusiness considerations:
The count should be appropriate for the business context and not exceed the available collection size. Consider both user experience and system performance when selecting sample sizes for API operations.
AI selection strategy: Choose counts that reflect realistic business requirements and typical usage patterns, especially when the sampled data will be used in subsequent API operations.
Type discriminator.
Random sampler for selecting multiple items from a collection.
Randomly selects a specified number of elements from a provided collection without duplication. Useful for creating realistic subsets of business data like featured products, selected users, or sample transactions for API operations.
E2E testing scenarios:
Usage with APIs: Often combined with
IApiOperateStatement
to perform operations on multiple randomly selected entities.AI function calling context: Use when business scenarios require multiple selections from a larger set without duplication, particularly for API operations that handle multiple entities.