# Categorical (CategoricalGenerator)

The [Categorical](/app/generation/generators/generator-reference/categorical.md) 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](/app/generation/generators/generator-characteristics/differential-privacy.md#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
      }
    }
  ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tonic.ai/app/api/quick-start-guide/tonic-api-generator-assignment/generator-api-reference/generator-api-ref-categorical.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
