
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A cryptographically secure random generator for real English words. Contains 370,000 words.
A cryptographically secure Node.js random generator for real English words. Contains over 350,000 English words. Supports custom word lists and optional seeded generation.
Upgrading from V3? See the upgrade guide.
Note: Rword stores its words array in memory, and limited testing shows this to add about ~20-60 MB to Node's heap depending on which word list you choose. Rword is built to be fast and self-contained without the need for a database and this price is paid at the expense of your RAM.
npm install rword rword-english-recommended
Using the recommended (smaller) word list:
import { words } from 'rword-english-recommended';
import { Rword } from 'rword';
const rword = new Rword(words);
rword.generate(); // ['pocketful']
rword.generate(4); // ['disrupter', 'recognizes', 'unbuckle', 'responding']
Using the extended (bigger) word list:
import { words } from 'rword-english-extended';
import { Rword } from 'rword';
const rword = new Rword(words);
rword.generate();
Generate reproducible words from a custom seed:
const seedRword1 = new Rword(words, 'your_custom_seed_123');
seedRword1.generate(3); // ['abandon', 'gunpowder', 'pole']
const seedRword2 = new Rword(words, 'your_custom_seed_123');
seedRword2.generate(3); // ['abandon', 'gunpowder', 'pole']
Rword offers two prebuilt English word lists you can install. Both contain only a-z characters. There are no numbers, symbols, spaces, or diacritics.
rword-english-recommended
rword-english-extended
Or, you can provide your own custom list as a string array or modify a prebuilt list. See below.
const rword = new Rword(words, seed)Creates an instance of Rword with the specified word list and optional seed.
words: string[] - The word list to load into the Rword instance.seed?: string - Optional - By providing a seed, you ensure that the sequence of random words generated by the instance is reproducible. This means that if you create two instances of Rword with the same word list and seed, they will generate the same sequence of words. This is not recommended unless you have a specific need for it.rword.generate(length): string[]Generates words from the instance's words array.
length: number - Optional (default 1) - How many words to returnYou may be tempted to use the shorthand new Rword('small').generate() as needed, but this is not recommended because creating an Rword instance causes the entire word list to be loaded and shuffled. It's recommended to keep and reuse as few instances as possible.
rword.shuffle(): voidShuffles the instance's words array. This method is automatically called upon instantiation.
rword.getWords(): string[]Returns the full (shuffled) words array used internally by the Rword instance.
rword.load(words): voidLoads a new array of words into the instance and shuffles it.
words: string[] - The array of words to load into the instance.rword instance, import the Rword class and then a separate word list like the rword-english-recommended packageImport:
import { rword } from 'rword';
import { words } from 'rword-english-recommended'; // or 'rword-english-extended'
import { Rword } from 'rword'; // Capitalized export
Create instance:
const rword = new Rword(words);
Generate words:
// has filtering options
// might return a string, or an array
rword.generate(5, { length: '3-10', contains: /pattern/ });
// has generateFromPool method for improved performance
rword.generateFromPool(5);
// only the number of words is accepted
// always returns an array
// only has a single generate method
rword.generate(5);
If you need the old filtering options, you should do this yourself on a words array and then load that new aray into an instance.
FAQs
A cryptographically secure random generator for real English words. Contains 370,000 words.
The npm package rword receives a total of 2,883 weekly downloads. As such, rword popularity was classified as popular.
We found that rword demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.