Actions40
- AI Actions
- Business Actions
- Calculate Actions
- Code Actions
- Convert Actions
- Crypto Actions
- Generate Actions
- Operator Actions
- PDF Actions
- Storage Actions
Generate → Number
AI-generatedOverview
This node generates a random number within a specified range. You can choose whether the output is an integer or a decimal. This functionality is useful in scenarios where you need to create test data, simulate randomness in workflows, or automate processes that require randomization (e.g., picking a winner, generating codes, or sampling).
Practical examples:
- Generating a random user ID between 1000 and 9999.
- Creating a random float for use in simulations or calculations.
- Selecting a random item from a list by generating a random index.
Properties
| Name | Meaning |
|---|---|
| Range Start | The lower bound of the generated number (inclusive). |
| Range End | The upper bound of the generated number (inclusive). |
| Type | Specifies the type of number to generate: - Integer - Decimal |
Output
The node outputs a JSON object containing the generated number. The structure is as follows:
{
"data": <number>
}
data: The randomly generated number, either integer or decimal, depending on the selected type.
Dependencies
- External Service: Requires access to the CodeKit API via the
codeKitApicredential in n8n. - n8n Configuration: Ensure the
codeKitApicredential is set up with the necessary API key or authentication details.
Troubleshooting
Common Issues:
- Invalid Range: If "Range Start" is greater than "Range End", the node may return an error or unexpected results. Always ensure the start is less than or equal to the end.
- Missing Credentials: If the
codeKitApicredential is not configured, the node will fail to execute. - Type Errors: Providing non-numeric values for "Range Start" or "Range End" will result in errors.
Error Messages:
"Missing required parameter": Make sure all required fields are filled."Authentication failed": Check yourcodeKitApicredentials."Invalid range": Verify that "Range Start" is less than or equal to "Range End".