Skip to main content

Scalar functions

normalDistribution

Commentary

added in 0.0.5

Generates numbers according to a normal distribution curve.


Examples

Generating decimal numbers

By default, this function generates floating point numbers.

{
"_gen": "normalDistribution",
"mean": 100,
"sd": 20
}
[
110.45178682132772,
78.0577956460505,
88.64041095922789,
80.64495551893957,
78.50653893144913
]

Generating integers

Use the decimals function modifier to generate integers.

{
"_gen": "normalDistribution",
"mean": 500,
"sd": 15,
"decimals": 0
}
[
489,
515,
513,
497,
520
]

Specification

JSON schema

{
"type": "object",
"properties": {
"mean": {
"oneOf": [
{
"type": "number"
},
{
"type": "object",
"properties": {
"_gen": {
"type": "string"
}
},
"required": [
"_gen"
]
}
]
},
"sd": {
"oneOf": [
{
"type": "number"
},
{
"type": "object",
"properties": {
"_gen": {
"type": "string"
}
},
"required": [
"_gen"
]
}
]
},
"decimals": {
"type": "integer",
"minimum": 0
}
},
"required": [
"mean",
"sd"
]
}