# Generators

All integers are `int64`

unless otherwise noted.

Random integer between `[min, max]`

with uniform or normal distribution

Param | Default | Valid Values (v) |
---|---|---|

`min` | 1 | v ≥ 0 |

`max` | 100,000 | v < 2^{64} |

`dist` | `uniform` | `uniform` or `normal` |

`mean` | (max-min+1)/2 | |

`stddev` | max-min/8.0 |

If `dist = normal`

, you can shift/scale the distribution by tweaking `mean`

and `stddev`

.

`p`

percentage of integers between `[min, max]`

with uniform random access

Param | Default | Valid Values (n) |
---|---|---|

`min` | 1 | 0 ≥ n < `max` |

`max` | 100,000 | `min` < n < 2^{64} |

`p` | 20 | 1–100 (percentage) |

Used to access a fraction of data with intentional gaps between accessed records.

Random ordered pairs `{n, n+size-1}`

where `n`

between `[min, max]`

with uniform distribution

Param | Default | Valid Values (n) |
---|---|---|

`min` | 1 | int |

`max` | 100,000 | int |

`size` | 100 | ≥ 1 |

Used for `BETWEEN @d AND @PREV`

.

Sequential ordered pairs `{n, n+size-1}`

from `begin`

to `end`

Param | Default | Valid Values (n) |
---|---|---|

`begin` | 1 | int |

`end` | 100,000 | int |

`size` | 100 | ≥ 1 |

Used to scan a table or index in order by a range of values: [1, 10], [11, 20].
When `end`

is reached, restarts from `begin`

.

Monotonically increasing uint64 counter from `start`

by `step`

increments

Param | Default | Valid Value (n) |
---|---|---|

`start` | 0 | 0 ≤ n < 2^{64} |

`step` | 1 | n ≥1 |

Every call adds `step`

then returns the value.
By default starting at zero, returns 1, 2, 3, etc.
If `start = 10`

, returns 11, 12, 13, etc.
If `start = 100`

and `step = 5`

, returns 105, 110, 115, etc.

Fixed-length string filled with random characters a-z and A-Z

Param | Default | Valid Value (n) |
---|---|---|

`len` | 100 | n ≥ 1 |

String length `len`

is *characters*, not bytes.

Returns rs/xid values as strings.

The `column`

generator is used for SQL modifiers `save-insert-id`

and `save-result`

Param | Default | Valid Value |
---|---|---|

`quote-value` | yes | string-bool |

The `quote-value`

param determines if the value is quoted or not when used as output to a SQL statement:

- yes →
`WHERE id = "%v"`

- no →
`WHERE id = %v`

The underlying MySQL column type does not matter because the value is not cast to a data type; it’s inputted and outputted as raw bytes.

The default data scope for column data is *trx*, not statement.
This can be changed with an explicit scope configuration.
Iter data scope might be useful, but statement (or value) scope will probably not work since the purpose is to resue the value in another statment.