AutoBE
    Preparing search index...

    Randomly selects an element from an array expression.

    Picks one element randomly from the provided array expression. Used for selecting categories, status values, etc. for API parameters and test data.

    interface IPickRandom {
        array: IExpression;
        type: "pickRandom";
    }
    Index

    Properties

    Properties

    Array expression to pick from.

    Must be an expression that evaluates to an array containing the candidate elements for random selection. Can be any expression type that produces an array:

    • Array literals with explicit elements
    • Variable references to previously captured arrays
    • Function calls that return arrays
    • Property access to array properties

    The array should contain at least one element for meaningful random selection. All elements should be of compatible types appropriate for the business context.

    Example:

    {
    "type": "pickRandom",
    "array": {
    "type": "arrayLiteralExpression",
    "elements": [
    { "type": "stringLiteral", "value": "electronics" },
    { "type": "stringLiteral", "value": "clothing" },
    { "type": "stringLiteral", "value": "books" }
    ]
    }
    }

    Business usage: Commonly used for selecting random categories, status values, or options in API operation parameters to create varied test scenarios.

    type: "pickRandom"

    Type discriminator