# Number handling functions

You can mask numbers.

| Function | Random masking | Consistent masking | Format-preserving encryption | Input data validation | Note |
| --- | --- | --- | --- | --- | --- |
| Generate value between two values | Yes | No | No | No | To mask values in a bijective manner, you can use the<br>tPatternMasking<br>component. |
| Numeric variance | Yes | No | No | No | - |

## Generate value between two values

This function generates a number randomly chosen between the user-defined minimum and maximum values.

| Option | Description |
| --- | --- |
| Extra parameter | This function requires an extra parameter.<br><br>The minimum and maximum values are specified as an extra parameter, by<br>a comma-separated list of two integers, for example: "1,10".<br><br>If the<br>user-defined minimum and maximum values do not use the right format, the<br>function returns the following masked values:<br><br><ul> <li>If the data type of the input column is String, the                           functions returns an empty string.</li> <li>If the data type of the input column is a numeric                           data type, the functions returns <span>0</span>.</li> </ul> |

The masked value has been randomly selected within the minimum value (50) and the maximum value (99) defined as extra parameters.

| Input value | Extra parameter | Example of a masked value |
| --- | --- | --- |
| 24 | "50,99" | 93 |

## Numeric variance

This function varies the input numeric value, based on the percentage specified as an extra parameter.

This function applies only to numeric data types: Integer, Long, Float and Double.

| Option | Description |
| --- | --- |
| Extra parameter | This function requires an extra parameter.<br><br>The extra parameter must be a number, this parameter<br>represents a percentage of modification. The function modifies the input<br>data by multiplying it by a number between the parameter and its<br>opposite.<br><br>For example, if the input is 100 and the parameter is 10, then the generated value will be a<br>randomly selected value between 90 (100 -<br>10%) and 110 (100 + 10%).<br><br>If the extra parameter is 0, it will be replaced with 10.<br><br>If the input is null, then the<br>function will return 0. |

In the following example, the masked value has been randomly selected between 5 (10 - 50%) and 15 (10 + 50%).

| Input value | Extra parameter | Example of a masked value |
| --- | --- | --- |
| 10 | "50" | 7 |