# Random data masking

Random masking consists of masking an input value with a randomly generated value.

When there are multiple occurrences of the same value in the input dataset, it can be masked with different values.

Different values from the input dataset can be masked with the same value.

For example, the following diagram shows an example of how the tDataMasking component can mask data randomly:

* The A value is masked with D when it first appears in the input dataset.
* The B and C values are masked with E.
* The A value is masked with F when it appears in the input dataset for the second time.

For example, the following diagram shows an example of how the tDataMaskingtDataMasking component can mask data randomly:

* The A value is masked with D when it first appears in the input dataset.
* The B and C values are masked with E.
* The A value is masked with F when it appears in the input dataset for the second time.

The A value is masked with D when it first appears in the input dataset.

The AA value is masked with DD when it first appears in the input dataset.

The B and C values are masked with E.

The BB and CC values are masked with EE.

The A value is masked with F when it appears in the input dataset for the second time.

The AA value is masked with FF when it appears in the input dataset for the second time. ![Example of random masking operation](https://help.qlik.com/talend/en-US/components/7.3/Resources/images/Example_of_random_masking_operation.png)

## Random data masking examples

The following table shows examples of generated masked values using the Replace the first n characters function:

| Input values | Extra Parameter | Examples of masked values |
| --- | --- | --- |
| newuser@domain.com | "4" | ohsbser@domain.com |
| admin@company.com | "4" | lneen@company.com |
| newuser@domain.com | "4" | qzmaser@domain.com |

The following table shows examples of generated masked values using the Generate from pattern function:

| Input values | Extra Parameter | Examples of masked values |
| --- | --- | --- |
| newuser@domain.com | "aaaaaa" | rxvsas |
| admin@company.com | "aaaaaa" | bbwpba |
| newuser@domain.com | "a9aaa9" | r8daw1 |

The following table shows examples of generated masked values for the Generate French SSN number function:

| Input values | Examples of masked values |
| --- | --- |
| 190049418437621 | 2590459222147 22 |
| 271083561478941 | 1900846274448 17 |
| 190049418437621 | 2730364078284 70 |
| 117029 | 1750694861914 69 |