Function modifiers
clamp
Commentary
added in 0.7.12
Restricts a numeric value within a given lower and upper range.
Examples
Clamping to literal values
Use clamp with a minimum and maxiumum value. In this example, the value will never be below 2 or above 15.
{
    "_gen": "normalDistribution",
    "mean": 10,
    "sd": 7,
    "clamp": [
        2,
        15
    ]
}
[
    2,
    3.077451212825995,
    15,
    10.324268381499666,
    2.3993498029579996,
    3.182385895989996,
    6.0515806281658175,
    8.702656824870752,
    15,
    2
]
Specification
JSON schema
{
    "type": "array",
    "minItems": 2,
    "maxItems": 2,
    "items": {
        "oneOf": [
            {
                "type": "number"
            },
            {
                "type": "object",
                "properties": {
                    "_gen": {
                        "type": "string"
                    }
                },
                "required": [
                    "_gen"
                ]
            }
        ]
    }
}