Get random number DAC
The Get random number dynamic advanced command is part of the variable commands. Use this command to generate a random number within a specified range and store it in a variable for use in your wizards. Drag it into a wizard from the Advanced commands view in the Nintex Wizard Editor to use it.
Before you begin:
- Learn how to navigate the Nintex Wizard Editor of the Studio. 
- Understand how to create wizards and use advanced commands. 
- Understand variables. 
- Learn how to customize error handling within an advanced command. 
- Understand how to configure wizard fallbacks. 
 When to use
When to use
                                                Use this command when you need to generate a random number for tasks such as creating unique codes, generating identifiers, or adding randomness to your automation processes. This is particularly useful for applications requiring unique or unpredictable values.
 Command setup
Command setup
                                                
                                                         
                                                    
In the Nintex Wizard Editor, search for the Get random number command and drag it into your steps. Use the table below to configure each field and understand the settings:
| Field | Description | What to do | |
|---|---|---|---|
| Get a random number | between | One value that defines one end of the range for generating the random number. This field can contain a number or a single variable. | Enter one of the two values that define the range. You can set the range from 100 to 500, or 1000 to 250. The command generates a random number within the given range, regardless of whether the first number is smaller or larger than the second. | 
| and | The value that defines the other end of the range for generating the random number. This field can contain a number or a single variable. | Enter the second value that defines the range. | |
| Return the result in variable | The name of the variable to store the generated random number. | Enter the name of the variable or select an existing one to store the result. | |
 Best practices
Best practices
                                                Follow these best practices when using the Get random number command:
- 
                                                            Ensure that the range you specify is appropriate for your use case to avoid unexpected results. 
- 
                                                            Use descriptive variable names to make it clear what the random number is being used for in your automation. 
 Example
Example
                                                This example shows how to generate a random number between 1000 and 9999 to create a unique login code for a user.
                                                         
                                                    
- 
                                                            Add the Get a random number command to your wizard and complete the following fields: - 
                                                                    Get a random number between: 1000 
- 
                                                                    and: 9999 
- 
                                                                    Return the result in variable: LoginCode 
 
- 
                                                                    
- 
                                                            Use the View variable list command to verify the command works as intended.