--- title: "Random text token" slug: "core-random-token-resolver" updated: 2026-04-15T13:57:42Z published: 2026-04-15T13:57:42Z canonical: "docs.lobstersoftware.com/core-random-token-resolver" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # Random text token *See also:* [Random long value](/v1/docs/en/core-random-long-resolver) > [!NOTE] > Value resolver – Abstract > > **Purpose:** Returns a random text token (`String`) as a hexadecimal representation of a random `Long` value. > > > [!TIP] > > Tooltip > > > > - **Usage**: The value resolver ignores the input value. It returns on the server side the `base36` representation of a random `Long` value, i.e. a combination of up to 13 digits or lowercase letters, possibly preceded by a minus sign. > > - **NOTE:** Depending on the `Long` value determined as a pseudo-random number, the text length of the supplied *text token* is between 1 and 14 characters. Different requirements for the length of the *text* *token* require specific configuration effort (see documentation for examples). > > - **WARNING:** In the client context, only the lowest 52 of the 64 bits from the `Long` value are considered, so only integers ≥0 (from the interval `[0;2^52[)` are returned. Therefore, a text token generated by a [Client Workflow](/v1/docs/en/frebehav-client-workflow) never starts with a minus sign and only reaches a maximum length of 11 characters. ![images/download/attachments/91131724/image2023-1-23_13-51-48-version-1-modificationdate-1674478308121-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2023-1-23_13-51-48-version-1-modificationdate-1674478308121-api-v2.png) The [Random text token](/v1/docs/en/core-random-token-resolver) value resolver returns a random text token (`String`). The generated *text token* is the `base36` image of a random `Long` value, i.e., on the server side, the hexadecimal representation of a 64-bit integer whose most significant bit defines the sign. For the arbitrarily named *text token* in the return value (`String`) this means specifically: - The string starts with a minus sign in approx. 50% of the cases. For positive values, no plus sign is prefixed. - Since the `base36` digit sequence does not use "leading zeros" for the absolute amount, a base36 digit (definition as a *regular expression*: `[0-9a-z])` must appear as the first character after the prefixed minus, if any. - Depending on the absolute value of the internally "cubed" `Long` value, this is followed by up to 12 further `base36` digits (`[0-9a-z]`). - The length of the returned text token can theoretically be between 1 and 14 characters due to the value range for `Long`, where 14 characters is only reached with the preceding minus. Even if the return value produces strings of 10 or more characters with high probability, the random occurrence of shorter strings at runtime should not be neglected across the board. --- **IMPORTANT:** In a [Client Workflow](/v1/docs/en/frebehav-client-workflow), only the lowest 52-bits of the random `Long` value are processed. The higher value bits are ignored or truncated. This also includes the sign bit (No. 64)! The value range in the [Client Workflow](/v1/docs/en/frebehav-client-workflow) is therefore limited to integers in the interval `[0;2^52[`. A text token generated via a [Client Workflow](/v1/docs/en/frebehav-client-workflow) therefore never starts with a minus sign and also only reaches a maximum length of 11 characters. --- **NOTE:** If a minimum text length (>1 character) is absolutely necessary for the random text, this must be systematically enforced by further measures. The examples (below) demonstrate with two differently elaborate approaches how this can be achieved. ## Configuration The [Random text token](/v1/docs/en/core-random-token-resolver) value resolver ignores the input value and does not use any parameters. ## Examples ### Random text token with exactly 14 characters The following configuration assigns a random sequence of digits and lowercase letters with a length of 14 characters to the variable `token`: ![images/download/attachments/91131724/image2023-1-23_13-52-23-version-1-modificationdate-1674478344044-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2023-1-23_13-52-23-version-1-modificationdate-1674478344044-api-v2.png) The value configuration on the right side of the [Set value](/v1/docs/en/core-set-value-actor) event action defines the assigned text value in three steps: - The first *substring* within the [Concat strings](/v1/docs/en/core-concat-string-resolver) value resolver is "cubed" with the [Random text token](/v1/docs/en/core-random-token-resolver) value resolver. - The [Concat strings](/v1/docs/en/core-concat-string-resolver) value resolver attaches a statically defined string of 13 zeros as the second *substring*. - The concatenated [Substring](/v1/docs/en/core-sub-string-resolver) value resolver returns only the first 14 characters of the concatenated string. The attached zeros compensate for the fact that the [Random text token](/v1/docs/en/core-random-token-resolver) value resolver can provide less than 14 characters. **NOTE:** Because the [Random text token](/v1/docs/en/core-random-token-resolver) value resolver reaches a text length only with return values that start with a minus sign, the "prepared" token with this configuration always ends with the character "0" if it does *not* start with a minus sign. ### Random text token with arbitrary length In an event handler, a random text token with 50 characters is to be reliably generated and assigned to the `token` variable. | The configuration shown on the right for a [For each loop](/v1/docs/en/core-for-each-entity-actor) event action, accesses the [Random text token](/v1/docs/en/core-random-token-resolver) value resolver up to 50 times to assign a sufficiently long string to the `token` variable by concatenation. **NOTE:** The variable token should be assigned "No value" (`$null`) or an empty string ("") before executing the loop to be on the safe side. The following steps are executed in the action block for iteration: - A [Set value](/v1/docs/en/core-set-value-actor) event action attaches the return value of a [Random text token](/v1/docs/en/core-random-token-resolver) value resolver to the possibly already existing text value of the variable `token` via the [Concat strings](/v1/docs/en/core-concat-string-resolver) value resolver, where the possibly preceding minus sign is removed from the text value resolved by the concatenated [Replace text](/v1/docs/en/core-replace-string-resolver) value resolver. - Subsequently, an [If then else](/v1/docs/en/core-if-then-else-actor) event action checks whether the length (`length`) of the text in the variable token already has sufficient length, i.e. whether its length is greater than or equal to the value of the loop variable `$length`. According to the parameterization for the **Resolver for entities** in the loop header, this variable contains the value 50. - If the `token` has reached or exceeded the desired length, the loop is to be terminated after the action block has been processed. A [Set value](/v1/docs/en/core-set-value-actor) event action assigns the value of the `$length` variable to the `$index` variable for this purpose. - Then – before the loop is exited – the text length is adjusted exactly to the required length (here: 50 characters) by limiting the text built up in the variable `token` to the number of characters specified in the variable `$length` via the [Substring](/v1/docs/en/core-sub-string-resolver) value resolver. **NOTE:** With multiple access to the `$length` variable automatically populated within the loop, the `token` length can be easily adjusted as needed by adjusting the **Resolver for entities** parameter in the loop header. | ![images/download/attachments/91131724/image2023-1-23_13-55-45-version-1-modificationdate-1674478545520-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2023-1-23_13-55-45-version-1-modificationdate-1674478545520-api-v2.png)![images/download/attachments/91131724/image2023-1-23_13-57-8-version-1-modificationdate-1674478628288-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2023-1-23_13-57-8-version-1-modificationdate-1674478628288-api-v2.png) | | --- | --- |