Skip to main content

random_int

Generate a random integer within the provided interval.

Parameters

NameDescriptionDefaultRequiredSupported DB types
columnThe name of the column to be affectedYesint2, int4, int8
minThe minimum threshold for the random valueYes-
maxThe maximum threshold for the random valueYes-
keep_nullIndicates whether NULL values should be replaced with transformed values or nottrueNo-
engineThe engine used for generating the values [random, hash]. Use hash for deterministic generationrandomNo-

Dynamic parameters

ParameterSupported types
minint2, int4, int8
maxint2, int4, int8

Description

The RandomInt transformer generates a random integer within the specified min and max thresholds. The behaviour for NULL values can be configured using the keep_null parameter.

The engine parameter allows you to choose between random and hash engines for generating values. Read more about the engines in the Transformation engines section.

Example: Generate random item quantity

In the following example, the RandomInt transformer generates a random value in the range from 1 to 30 and assigns it to the orderqty column.

generate random orderqty in the range from 1 to 30
- schema: "sales"
name: "salesorderdetail"
transformers:
- name: "RandomInt"
params:
column: "orderqty"
min: 1
max: 30

Result

ColumnOriginalValueTransformedValue
orderqty129

Example: Generate random sick leave hours based on vacation hours

In the following example, the RandomInt transformer generates a random value in the range from 1 to the value of the vacationhours column and assigns it to the sickleavehours column. This configuration allows for the simulation of sick leave hours based on the number of vacation hours.

RandomInt transformer example
- schema: "humanresources"
name: "employee"
transformers:
- name: "RandomInt"
params:
column: "sickleavehours"
max: 100
dynamic_params:
min:
column: "vacationhours"

Result

ColumnOriginalValueTransformedValue
sickleavehours6999
Copyright © GreenMask 2026