Chance.js
Chance.js is a JavaScript library for generating random values for automated tests and other uses that need sample data.
What Chance.js is
Chance.js is a JavaScript library for generating random values for automated tests and other uses that need sample data. Its generators cover basics, text, people, mobile identifiers, web data, locations, time, finance, helpers and miscellaneous values. It can be installed from npm for use in Node.js or loaded in a browser, where developers can use a global instance or create multiple instances. A separate chance-cli package provides command-line access to generators and options. Developers can supply a seed to make an instance’s output repeatable; instances with the same seed can produce the same sequence. The integer generator accepts inclusive minimum and maximum bounds, and `unique()` can create arrays of non-repeating generated items. Chance is free and open source under the MIT License. Its values are pseudorandom, so it is not suitable for cryptographic applications that require true randomness. The documented name generator supports English and Italian nationality options.
Good
- Free and released under the MIT License
- Generators span text, people, finance, locations, and more
- Seeds can make output repeatable
- `unique()` creates arrays of non-repeating items
- Usable in browsers, Node.js, and via a CLI
Watch out
- Values are pseudorandom, not cryptographically secure
- Name nationality options are limited to English and Italian
Who it suits
Chance.js suits developers who need generated sample data for automated tests, including names and addresses. It is available for browser and Node.js use, with a command-line package also documented.
Verdict
Chance.js offers a broad set of random-data generators and options for repeatable output. It is a practical fit for test data, but not for cryptographic uses requiring true randomness.
Plans and prices
From Chance.js's own pricing page, checked 10 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| Chance.js | Free | Open source · MIT License |
The facts
Each one read from Chance.js's own pages, with the date it was checked.
Where it runs
- Browser use
- In a browser, Chance can expose a global `chance` instance, and users can also create multiple instances.checked 10 Oct 2026
What it does
- Command line
- The site documents a CLI package, installed globally with `npm install -g chance-cli`, for invoking generators by name.checked 10 Oct 2026
- Data types
- Its generators cover items including text, people, locations, dates, finance, and web-related values.checked 9 Oct 2026
- File sizes
- The site lists chance.js as 95KB uncompressed and chance.min.js as 55KB, or 17KB gzipped.checked 9 Oct 2026
- Generator categories
- The documented generators cover basics, text, people, mobile identifiers, web data, locations, time, finance, helpers, and miscellaneous values.checked 10 Oct 2026
- Integrations
- The documentation includes installation and usage instructions for Bower and RequireJS, as well as npm for Node.js.checked 10 Oct 2026
- Intended users
- The site gives generating random names and addresses for automated tests as an intended practical use.checked 9 Oct 2026
- License
- Chance is open source and released under the MIT License.checked 10 Oct 2026
- Name generation limit
- The name generator's documented nationality support is limited to English (`en`) and Italian (`it`).checked 10 Oct 2026
- Node.js
- Chance can be installed with npm and used in a Node.js application.checked 9 Oct 2026
- Node.js use
- Chance can be installed from npm with `npm install chance` and used in Node.js.checked 10 Oct 2026
- Purpose
- Chance generates pseudo-random strings, numbers, and other values for automated tests and other uses that need random data.checked 10 Oct 2026
- Random integer ranges
- The integer generator accepts optional inclusive minimum and maximum bounds.checked 10 Oct 2026
- Repeatable output
- A developer can provide a seed when creating an instance to make its output repeatable.checked 9 Oct 2026
- Security limitation
- The site cautions that Chance should not be used for cryptographic applications requiring true randomness because it generates pseudo-random values.checked 10 Oct 2026
- Seeded repeatability
- Instances initialized with the same seed can produce the same sequence of random values.checked 10 Oct 2026
- Unique values
- The `unique()` helper builds an array of non-repeating generated items of a requested length.checked 10 Oct 2026
The company
- Founded
- 2013checked 28 Sep 2026
- Maker
- The site credits Victor Quinn as the writer of Chance.checked 10 Oct 2026
Alternatives to Chance.js
- 1

Benerator
Free planOpen sourceWebAPILinuxmacOS7.6Free plan - 2
RandomUser
Free planOpen sourceWebAPIExtensionSelf-hosted7.1Free plan - 3

Tonic Fabricate
Free planWebAPISelf-hosted6.8$29 usage-based - 4

Mockaroo
Free planWebAPISelf-hosted6.7From $60 a year - 5

Synthetic Data Vault
Free planAPISelf-hosted6.6From $250 a month - 6
JSON Schema Faker
Free planWebLinuxmacOSSelf-hosted6.4Free plan
