core.select
Emits a value from exactly one of a set of sub-streams, selected at random. By default, each sub-stream has an equal chance of being selected. However, weights can be assigned to each sub-stream to adjust the probability of selection.
May be identified via the short nameselect
Keywords
options
required
An array of objects that must include a stream
field and an optional weight
field.
Examples
Alternates between the string "one" and the number 2.
{
"type": "core.select",
"options": [
{
"stream": {
"type": "core.constant",
"value": "one"
},
},
{
"stream": {
"type": "core.constant",
"value": 2
},
}
]
}
Emits a positive integer 80% of the time, andnull
20% of the time.
{
"type": "core.select",
"options": [
{
"weight": 4,
"stream": {
"type": "integer",
"minimum": 0
},
},
{
"weight": 1,
"stream": {
"type": "null",
},
}
]
}