Skip to content

Range Production

Authors
Joe Starr, Ph.D. image

Joe Starr, Ph.D.

I specialize in computational knot theory. I’m also a professional embedded software engineer.

What Is a Range Production?

A range production models the random selection of an integer from a configured range.

Using a Range Production

Configuring

A range production contains two configurable integer bounds a lower and upper bound.

Note

A production configured so the lower and upper bounds are equal is possible and will produce the same value on every execution.

Warning!

In line with the PDGL portability and memory goals the output buffer for a range production is a fixed size of length DEFS_PDGL_MAX_STRING_SIZE.

Examples

Single Option

[[production]]
name = "entry"
type = "pure"
replacements = ["%{prod}"]
terminals = [""]

[[production]]
name = "prod"
type = "range"
lower_bound = -10
upper_bound = 10

Recursive

[[production]]
name = "entry"
type = "pure"
replacements = ["%{prod}"]
terminals = [""]

[[production]]
name = "prod"
type = "range"
lower_bound = 10
upper_bound = 10

Multiple Options

[[production]]
name = "entry"
type = "range"
lower_bound = -10
upper_bound = 10

Production Schema

{
    "$id": "range-production_schema",
    "$schema": "https://json-schema.org/draft/2020-12/schema",

    "type": "object",
    "properties": {
        "name": {
            "type": "string"
        },
        "type": {
            "const": "range"
        },
        "upper_bound": {
            "type": "integer"
        },
        "lower_bound": {
            "type": "integer"
        }
    },
    "additionalProperties": false,
    "minProperties": 4
}