> ## Documentation Index
> Fetch the complete documentation index at: https://docs.terminus.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Random field

> A computed field that generates a random string of a fixed length from the character sets you enable.

<Info>
  The Random field generates a random string once per record, drawn from the character sets you turn on. The value is generated for you, so submitters never type it.
</Info>

Random is a **computed** field. Its value is system-generated, the field is always required, and it does not appear as an input a submitter can fill in.

## When to use it

Reach for Random when you want an unpredictable token on each record:

* Access codes, opaque references, or sample identifiers.
* A short random segment to fold into a [Concatenation](/reference/fields/concatenation) field.
* A value where a sequential number would be too easy to guess and a Terminus ID's fixed shape is not what you want.

<Warning>
  Do not use Random when you need a guaranteed-unique value. Random does not check for collisions. Use [Terminus ID](/reference/fields/terminus-id) for a system-unique handle, or [Auto Number](/reference/fields/auto-number) for a guaranteed-distinct sequence.
</Warning>

## How it works

The first time you submit a record, the field generates a string of `length` characters using the character sets you enabled, then keeps that value for the life of the record. It is not re-rolled when you edit or re-save the record later.

You choose which character sets to draw from. At least one of the three must be on.

## Settings reference

| Setting             | Required | Default | Description                                         |
| ------------------- | -------- | ------- | --------------------------------------------------- |
| `length`            | Yes      | None    | Number of characters to generate, from `1` to `50`. |
| `include_numbers`   | Yes      | None    | Include digits `0-9`.                               |
| `include_lowercase` | Yes      | None    | Include lowercase letters `a-z`.                    |
| `include_uppercase` | Yes      | None    | Include uppercase letters `A-Z`.                    |

At least one of `include_numbers`, `include_lowercase`, and `include_uppercase` must be `true`.

## Example

An `access_code` field on a Passes taxonomy:

```yaml theme={null}
name: access_code
type: random
settings:
  length: 8
  include_numbers: true
  include_lowercase: false
  include_uppercase: true
```

A new record might get `K7P2QXM9`: eight characters of uppercase letters and digits. That value is generated once, when you first submit the record, and stays the same from then on.

## Gotchas

* **The value is stable, not regenerated.** It is produced once at first submission and kept afterward. Editing the record later does not change it.
* **Random is not unique.** There is no collision check across records, so two records can in principle land on the same string. For uniqueness, use [Terminus ID](/reference/fields/terminus-id) or [Auto Number](/reference/fields/auto-number).
* **Enable at least one character set.** With all three off, the field has no characters to draw from.
* **Short strings collide more often.** The shorter the `length` and the fewer the enabled sets, the higher the chance of a repeat.
* **It is read-only.** The value is generated for you and cannot be set or edited in the submission form.

## Related

* [Fields](/reference/fields)
* [Auto Number field](/reference/fields/auto-number): sequential, guaranteed-distinct numbers.
* [Terminus ID field](/reference/fields/terminus-id): a system-unique identifier.
* [Other computed fields](/recipes/other-computed-fields)
