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
}
[
64.72646534676443,
127.36947205353196,
115.56279260333578,
57.27282923963099,
118.14470503230018
]

Generating integers

Use the decimals function modifier to generate integers.

{
"_gen": "normalDistribution",
"mean": 500,
"sd": 15,
"decimals": 0
}
[
482,
501,
518,
477,
504
]

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"
]
}