--- title: "Random long value" slug: "core-random-long-resolver" updated: 2026-04-15T13:54:03Z published: 2026-04-15T13:54:03Z canonical: "docs.lobstersoftware.com/core-random-long-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 long value *See also:* [Random text token](/v1/docs/en/core-random-token-resolver) > [!NOTE] > Value resolver – Abstract > > **Purpose:** Returns an integer signed 64-bit (`Long`) pseudo random number on the server side. > > > [!TIP] > > Tooltip > > > > - **Usage**: The value resolver returns a signed 64-bit (`Long`) integer pseudorandom number on each call. The input value is ignored. > > - **Note**: To obtain random numbers in a certain range of values, the modulo operator (%) can be used in a concatenated [Calculate value](/v1/docs/en/core-calculate-value-resolver) value resolver, for example. > > - **Example**: Calculation expression `abs(random%limit`) returns random numbers in the range `{0, ..., limit-1}` if `random` is a [Random long value](/v1/docs/en/core-random-long-resolver). > > - **WARNING:** In the client context, only the lowest 52 of the 64 bits are considered, so only integers ≥0 (from the interval `[0;2^52[)`are returned. ![images/download/attachments/201662993/image2022-1-19_9-38-38-version-1-modificationdate-1742282338198-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2022-1-19_9-38-38-version-1-modificationdate-1742282338198-api-v2.png) The [Random long value](/v1/docs/en/core-random-long-resolver) resolver returns a signed 64-bit (`Long`) integer pseudorandom number on the server side. --- **IMPORTANT:** In a [Client Workflow](/v1/docs/en/frebehav-client-workflow), the [Random long value](/v1/docs/en/core-random-long-resolver) resolver returns only the lowest 52-bits of the random `Long` value for technical reasons. 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[`, while on the server side the 64-bit value range spans approximately symmetrically around 0. --- ## Configuration The value resolver ignores the input value and does not use any parameters. ## Example An event handling makes a random selection from a number of options. The options for the selection are determined "dynamically" at runtime via a [Search (Event action)](/v1/docs/en/core-search-actor). The number of options can vary depending on the basic data and the search criteria. All options qualified by the [Search (Event action)](/v1/docs/en/core-search-actor) are considered equally in the random selection, i.e. selected with the same degree of probability. In the specific example, an event handling should make a random single selection from a subset of instances for a *custom entity type* (see [Custom type definitions](/v1/docs/en/custom-custom-type-definition)) "Aircraft" (`Aircraft`), whose suitability for a specific use is checked by [Restrictions](/v1/docs/en/core-i-search-restriction) within the [Search](/v1/docs/en/core-search). Configuration: | The screenshot on the right shows an overview of the configuration of event handling, which determines a list of qualified "candidates", makes a random selection and communicates the decision via a notification: - First, a [Search (Event action)](/v1/docs/en/core-search-actor) is executed to determine *suitable* candidates from all instances for a *custom entity type* "Aircraft" for which read access exists in the execution context. The list of these candidates for the random selection is written to the [Variable](/v1/docs/en/core-storage-value) `acft_subset` as a "result list". - All further steps take place in the *action block* of an [Execute with](/v1/docs/en/core-with-actor) event action, which defines the list of candidates in the [Variable](/v1/docs/en/core-storage-value) `acft_subset` as a *temporary reference object* using the **Object resolver** parameter: - In the first step, the *return value* of the [Random long value](/v1/docs/en/core-random-long-resolver) resolver is used to make a random selection from the candidates in the [Variable](/v1/docs/en/core-storage-value) `acft_subset`. Within a [Set value](/v1/docs/en/core-set-value-actor) event action, the index number of the list value to be selected is "rolled" and assigned to the `randomPick` variable as an `Integer` value: - Within the value resolver chain for the value to be assigned (right), the number of candidates is first determined using the [Object property](/v1/docs/en/core-property-resolver) resolver from the `length` field of the list given as the *reference object*. In the [Calculate value](/v1/docs/en/core-calculate-value-resolver) resolver, the *input value* can be addressed here by concatenation via the "Variable name" input. The [Random long value](/v1/docs/en/core-random-long-resolver) resolver is also included via the configuration for the **Variable name** `random`. - The calculation expression `abs(random%input)`uses this to determine an index value in the permitted range. The index of the list begins with the start value `0`, so that the maximum permissible index value of a list is `length-1`. The remainder of an integer division (using the modulo operator `%`) by the number of list values (`length = input`) therefore represents the desired value range if the sign for negative values is ‘eliminated’ using the `abs()`function. - An integer is taken from the calculation result with the data type "Unit number" (`UnitNumber`) by assigning it to the [Variable](/v1/docs/en/core-storage-value) `randomPick` (left) with the **Type** integer. - Finally, the result of the random selection is revealed by a [Show alert](/v1/docs/en/freaction-show-alert) event action (see below). | ![images/download/attachments/201662993/image-2025-3-18_9-24-16-version-1-modificationdate-1742286255966-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-18_9-24-16-version-1-modificationdate-1742286255966-api-v2.png) | | --- | --- | | The screenshot on the right shows the configuration for the [Show alert](/v1/docs/en/freaction-show-alert) event action, which is still executed in the context of the [Execute with](/v1/docs/en/core-with-actor) event action with the list of candidates as the *reference object*: - The *value configuration* for the **Title** parameter provides information about the number of selected candidates: - The output text is initially defined here as static [Text](/v1/docs/en/core-text-value-editor) with a placeholder symbol (`#`). - The concatenated [Replace text](/v1/docs/en/core-replace-string-resolver) resolver replaces the placeholder (**Search text** *#*) with the "Length" of the candidate list, which is determined from the *reference object* in the *value configuration* for the **Replace with** parameter using the [Object property](/v1/docs/en/core-property-resolver) resolver. - The *value configuration* for the **Message** concatenates further value resolvers: - The [List item](/v1/docs/en/core-list-item-resolver) resolver refers to the candidate list (*reference* *object*) and uses the **Mode** "Get first" to determine the list entry to be returned via the **Offset**. The name of the [Variable](/v1/docs/en/core-storage-value) `randomPick` is entered in the **Offset** parameter, the return value of which specifies the ‘checked’ index of the list item at runtime. - The concatenated [Store value as variable](/v1/docs/en/core-store-value-resolver) resolver stores the randomly selected ‘Aircraft’ instance in another [Variable](/v1/docs/en/core-storage-value) `pickedAcft`, which can be accessed by subsequent event actions. - The concatenated [Object property](/v1/docs/en/core-property-resolver) resolver reads the `registration` field from the ‘Aircraft’ instance, the value of which is used to identify the selection in the **Message**. - Runtime example: ![images/download/attachments/201662993/image-2025-3-18_9-16-19-version-1-modificationdate-1742285778348-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-18_9-16-19-version-1-modificationdate-1742285778348-api-v2.png) **NOTE:** The "cloze text" in the **Title** for the [Show alert](/v1/docs/en/freaction-show-alert) event action can be executed in multiple languages by using a [Value from localization](/v1/docs/en/core-resource-resolver) resolver in conjunction with a localization entry that provides a (`{0}`) parameter for the number of options. | ![images/download/attachments/201662993/image-2025-3-18_9-25-3-version-1-modificationdate-1742286302372-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-18_9-25-3-version-1-modificationdate-1742286302372-api-v2.png) |