Skip to main content

Scalar functions

bytes

Commentary

added in 0.3.20

Generates random byte arrays of the specified size, which is mainly useful for increasing event size in performance testing.


Examples

Generating bytes

Use a constant to generate byte arrays of the same size.

{
"_gen": "bytes",
"size": 24
}
[
"jKY3dYZUy+VbOmUvK046a4CHjq/XGvPY",
"20sTcfyKJVYrXnN1AfJWbPwFxSBKh2oN",
"eyWaJ4VKV5rcEm33QO6JKvJNb2DLiXN7",
"IkD2APnbn5LhNwFIQspthFOmTIlGFA+2",
"1JzK98v5J61lcQEOrmHi2VCcNURX+snI"
]

Varied sizes

Use a function to generate byte arrays of varying sizes, in this case between 10 and 50 bytes.

{
"_gen": "bytes",
"size": {
"_gen": "uniformDistribution",
"bounds": [
10,
50
]
}
}
[
"/Mm1N4HupJPYvLjSOtU/uhQXf0OoAZeY+DT+dH8WbNFr74cbvUs+4nPvTvFof3Ff",
"fOPlius3ENcJKjKXFbbLGEGGCkKg+s7p8t3EM+VBCZ0/KS+LgA==",
"0mlm//AI7P/9rlQFAM3nlguGB6L+03nHeBzWbvqIeYTFqoKc6XQgExiPdJ1qvup+",
"/0VTtDQzUX9S8JGkIR5nsIIrD3eNnR+n/cTE4QEH3lsejXB34i4GjcE2Fviw",
"VrvzOtrBUC3U/I4EU6FstvHdhnSzyhWMv6Lb0dzW43U="
]

Specification

JSON schema

{
"type": "object",
"properties": {
"size": {
"oneOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "object",
"properties": {
"_gen": {
"type": "string"
}
},
"required": [
"_gen"
]
}
]
}
},
"required": [
"size"
]
}