Scalar functions
uniformDistribution
Commentary
added in 0.0.5
Generates numbers according to a uniform distribution curve.
Examples
Generating decimal numbers
By default, this function generates floating point numbers.
{
"_gen": "uniformDistribution",
"bounds": [
1,
10
]
}
[
1.0122730367194843,
7.370725796419692,
2.5526220285624417,
2.6744435984288244,
1.6484482678210184
]
Generating integers
Use the decimals
function modifier to generate integers.
{
"_gen": "uniformDistribution",
"bounds": [
50,
100
],
"decimals": 0
}
[
50,
85,
58,
59,
53
]
Specification
JSON schema
{
"type": "object",
"properties": {
"bounds": {
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": {
"oneOf": [
{
"type": "number"
},
{
"type": "object",
"properties": {
"_gen": {
"type": "string"
}
},
"required": [
"_gen"
]
}
]
}
},
"decimals": {
"type": "integer",
"minimum": 0
}
},
"required": [
"bounds"
]
}