random-number

Generate random integers, decimals and booleans in n8n workflows, with optional seeding for repeatable results

Package Information

Released: 1 mo ago
Downloads: 0 weekly / 0 monthly
Latest Version: 0.1.3
Author: Naji El Kotob

Available Nodes

Documentation generating…

Documentation

n8n-nodes-random-number

An n8n community node that generates random integers, decimals and booleans – with an optional seed, so the same run can be repeated exactly.

n8n can already produce a random value in an expression. What it can't do is make that value reproducible, weight it, or generate a batch of them without writing code. This node covers those cases in the UI.

Installation

In n8n, go to Settings → Community nodes → Install and enter n8n-nodes-random-number.

Operations

Operation What it returns
Integer A whole number between Minimum and Maximum, both included
Decimal A number between Minimum and Maximum, rounded to the decimal places you set
Boolean true or false, using a probability you choose – 0.3 gives roughly a 30/70 split

Options

Option Purpose
Seed Any text. The same seed always produces the same sequence, which makes a workflow using randomness testable. Leave empty for unpredictable values.
Count Generate several values per item. Above 1, the output field holds an array.
Output Field Name Where the value is written. Defaults to random.
Cryptographically Secure Draws from Node's crypto module instead of Math.random, for tokens and codes. Ignored when a seed is set, since a seeded sequence is predictable by design.
Generate Once for All Items Produce one value and reuse it across every incoming item, instead of one per item.

Each item passes through unchanged with the value added as a new field. Minimum, Maximum and Probability all accept expressions, so the range can come from your data – for example {{ $json.maxScore }}.

Example uses

  • A/B split – Boolean with probability 0.5, then an IF node on the result
  • Canary runs – probability 0.05 so a branch only fires on about 1 in 20 executions
  • Sampling – give each row a random number, sort, take the top 25 for review
  • Test data – Count 100 to fill a batch with plausible values before real data exists
  • Jitter – feed the output into a delay so requests aren't evenly spaced

Compatibility

Requires n8n 1.0 or later. No credentials and no runtime dependencies.

Resources

Version history

0.1.0 – First release: Integer, Decimal and Boolean operations with seeding, count, crypto-secure mode and generate-once.

License

MIT

Discussion