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
}
[
"lDH/o+XtxGV9HkLU3ivTkm12WG/AGRdC",
"Ene98arqXdJGYy3khD/AqEfpDiGDGTad",
"6gxYsNKA+nziaSQ1ulaJXF4VWTMHXey8",
"dyv4/n/4+NpXfBj4nar5VvqlSoHwPg7C",
"8IL+F9FC4LmWAz2CUiIxgpeWCtuGQ4HG"
]

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
]
}
}
[
"ebFqbMuYJ/y9P9CIQXIOIdXfTw==",
"19X5imtVACbXHRgn75z+mDP52Q==",
"u0rYwFyBHFRU8UX4MBdauKJCkOfym0Zjk3MnodUz5wM=",
"BTfmhJBdlhrVMA==",
"hlTL5Vs6ZS8rTjprgIeOr9ca89jbSxNx/IolVitec3UB8lZs/AXFIEqHag0="
]

Specification

JSON schema

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