0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Generate → Number

AI-generated

Overview

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 codeKitApi credential in n8n.
  • n8n Configuration: Ensure the codeKitApi credential 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 codeKitApi credential 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 your codeKitApi credentials.
  • "Invalid range": Verify that "Range Start" is less than or equal to "Range End".

Links and References

Discussion