# Categorical (CategoricalGenerator)

The [Categorical](https://docs.tonic.ai/app/generation/generators/generator-reference/categorical) generator creates values at the same frequency and using the same values, including NULL values, as the underlying data. In other words, it shuffles the existing values within a field.

## Link object structure <a href="#generator-api-categorical-link-object" id="generator-api-categorical-link-object"></a>

The Categorical generator does not support consistency. You can configure differential privacy. You can link columns.

The `metadata` object is populated from the [`CategoricalMetadata`](https://app.tonic.ai/apidocs/index.html#/models/CategoricalMetadata) object. It contains the `epsilon` field, which provides the [privacy budget for differential privacy](https://docs.tonic.ai/app/generation/generators/generator-characteristics/differential-privacy#privacy-budget).

```json
{
  "schema": "string",
  "table": "string",
  "column": "string",
  "path": "string",  //JSON fields only
  "dataType": "string",  //MongoDB, Amazon DynamoDB, and JSON fields only
  "metadata": {
    "presetId": "string",
    "generatorId": "CategoricalGenerator",
    "epsilon": numeric,
    "isDifferentiallyPrivate": boolean,
    "encryptionProcessor": "x-on", //To use configured Structural data encryption
    "customValueProcessor": "string" //If custom value processor applied
  }
}
```

## Example replacement <a href="#generator-api-categorical-replacement" id="generator-api-categorical-replacement"></a>

The following example replacement shows a single, un-linked column. Differential privacy is enabled, and `epsilon` is set to 1.

```json
{
  "name": "userstatus",
  "schema": "test",
  "table": "users",
  "links": [
    {
      "schema": "test",
      "table": "users",
      "column": "userstatus",
      "metadata": {
        "presetId": "CategoricalGenerator",
        "generatorId": "CategoricalGenerator",
        "epsilon": 1,
        "isDifferentiallyPrivate": true
      }
    }
  ]
}
```
