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": 12.4477,
"b": 12.3697,
"c": 5.097
},
{
"a": 12.4477,
"b": 13.0369,
"c": 9.5853
},
{
"a": 12.4477,
"b": 9.4151,
"c": 10.2485
},
{
"a": 12.4477,
"b": 9.4151,
"c": 10.3074
},
{
"a": 12.4477,
"b": 12.3697,
"c": 10.7075
},
{
"a": 12.4477,
"b": 13.0369,
"c": 10.7857
},
{
"a": 12.4477,
"b": 9.4151,
"c": 11.2496
},
{
"a": 12.4477,
"b": 13.0369,
"c": 13.1487
},
{
"a": 12.4477,
"b": 13.0369,
"c": 12.0726
},
{
"a": 12.4477,
"b": 13.0369,
"c": 11.167
}
]
Specification
JSON schema
{
"type": "integer",
"minimum": 1
}