RandomNumeric
Generate a random numeric within the provided interval.
Parameters¶
| Name | Description | Default | Required | Supported DB types |
|---|---|---|---|---|
| column | The name of the column to be affected | Yes | numeric, decimal | |
| min | The minimum threshold for the random value. The value range depends on the column type. | Yes | - | |
| max | The maximum threshold for the random value. The value range depends on the column type. | Yes | - | |
| decimal | The decimal of the random numeric value (number of digits after the decimal point) | 4 |
No | - |
| keep_null | Indicates whether NULL values should be replaced with transformed values or not | true |
No | - |
| engine | The engine used for generating the values [random, hash]. Use hash for deterministic generation |
random |
No | - |
Dynamic parameters¶
| Parameter | Supported types |
|---|---|
| min | int2, int4, int8, float4, float8, numeric, decimal |
| max | int2, int4, int8, float4, float8, numeric, decimal |
Description¶
The RandomNumeric transformer generates a random numeric value within the provided interval, starting from min to
max, with the option to specify the number of decimal digits by using the decimal parameter. 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 price¶
In this example, the RandomNumeric transformer generates random prices in the range from 0.1 to 7000 while
maintaining a decimal of up to 2 digits.
RandomNumeric transformer example
- schema: "sales"
name: "salesorderdetail"
transformers:
- name: "RandomNumeric"
params:
column: "unitprice"
min: 0.1
max: 7000
decimal: 2
- The type overrides applied for example because the playground database does not contain any tables with numeric columns.
Result:
| Column | OriginalValue | TransformedValue |
|---|---|---|
| unitprice | 2024.994 | 4449.7 |