Function modifiers
cardinality
Commentary
added in 0.8.3
Restricts the maximum number of unique values that a function can generate. When the limit is exceeded, previously generated values will be chosen at random.
Note that this modifier is a ceiling: if a function can't generate more unique values than the specified cardinality, it won't reach the cardinality limit.
Examples
Setting cardinality
Set cardinality
to a positive integer. In this example:
a
is only ever assigned one unique valueb
is assigned 3 unique values, after which older values are reusedc
always contains newly generated values
{
"a": {
"_gen": "normalDistribution",
"mean": 10,
"sd": 2,
"decimals": 4,
"cardinality": 1
},
"b": {
"_gen": "normalDistribution",
"mean": 10,
"sd": 2,
"decimals": 4,
"cardinality": 3
},
"c": {
"_gen": "normalDistribution",
"mean": 10,
"sd": 2,
"decimals": 4
}
}
[
{
"a": 9.9909,
"b": 11.6654,
"c": 8.4316
},
{
"a": 9.9909,
"b": 10.3735,
"c": 8.9359
},
{
"a": 9.9909,
"b": 12.7664,
"c": 8.2776
},
{
"a": 9.9909,
"b": 10.3735,
"c": 7.9199
},
{
"a": 9.9909,
"b": 11.6654,
"c": 9.4142
},
{
"a": 9.9909,
"b": 12.7664,
"c": 12.7479
},
{
"a": 9.9909,
"b": 12.7664,
"c": 8.4881
},
{
"a": 9.9909,
"b": 10.3735,
"c": 11.5025
},
{
"a": 9.9909,
"b": 12.7664,
"c": 4.7392
},
{
"a": 9.9909,
"b": 12.7664,
"c": 9.0051
}
]
Specification
JSON schema
{
"type": "integer",
"minimum": 1
}