Skip to content
SPECIFICTION
Get listed

Chance.js

chancejs.com

Free plan WebAPI
Visit chancejs.com
Spec score 8.3 #2 of 28 in Test Data Generation Tools

What it is

Chance.js is a free, MIT-licensed JavaScript library for generating pseudorandom data used in automated tests and other applications needing sample values. Generators cover basic values, text, people, mobile identifiers, web data, locations, dates, finance, helpers, and miscellaneous categories. Developers can install it with npm for Node.js, load it in a browser, or use the separate chance-cli package from the command line. Browser users may create a global instance or instantiate several instances. Supplying a seed makes output repeatable; instances given the same seed can produce the same sequence. Integer generation accepts inclusive minimum and maximum bounds, and the unique() helper builds arrays without repeated generated items. The documented name generator supports English and Italian nationality options. The site lists chance.js at 95KB uncompressed and chance.min.js at 55KB, or 17KB gzipped. Chance is not intended for cryptographic applications requiring true randomness. The site credits Victor Quinn as its writer.

Spec sheet

Purpose
Chance generates pseudo-random strings, numbers, and other values for automated tests and other uses that need random data.Read 10 Oct 2026 · chancejs.com
Intended users
The site gives generating random names and addresses for automated tests as an intended practical use.Read 9 Oct 2026 · chancejs.com
Integrations
The documentation includes installation and usage instructions for Bower and RequireJS, as well as npm for Node.js.Read 10 Oct 2026 · chancejs.com
License
Chance is open source and released under the MIT License.Read 10 Oct 2026 · chancejs.com
Founded
2013Read 28 Sep 2026 · chancejs.com
Maker
The site credits Victor Quinn as the writer of Chance.Read 10 Oct 2026 · chancejs.com
Browser use
In a browser, Chance can expose a global `chance` instance, and users can also create multiple instances.Read 10 Oct 2026 · chancejs.com
Command line
The site documents a CLI package, installed globally with `npm install -g chance-cli`, for invoking generators by name.Read 10 Oct 2026 · chancejs.com
Data types
Its generators cover items including text, people, locations, dates, finance, and web-related values.Read 9 Oct 2026 · chancejs.com
File sizes
The site lists chance.js as 95KB uncompressed and chance.min.js as 55KB, or 17KB gzipped.Read 9 Oct 2026 · chancejs.com
Generator categories
The documented generators cover basics, text, people, mobile identifiers, web data, locations, time, finance, helpers, and miscellaneous values.Read 10 Oct 2026 · chancejs.com
Name generation limit
The name generator's documented nationality support is limited to English (`en`) and Italian (`it`).Read 10 Oct 2026 · chancejs.com
Node.js
Chance can be installed with npm and used in a Node.js application.Read 9 Oct 2026 · chancejs.com
Node.js use
Chance can be installed from npm with `npm install chance` and used in Node.js.Read 10 Oct 2026 · chancejs.com
Random integer ranges
The integer generator accepts optional inclusive minimum and maximum bounds.Read 10 Oct 2026 · chancejs.com
Repeatable output
A developer can provide a seed when creating an instance to make its output repeatable.Read 9 Oct 2026 · chancejs.com
Security limitation
The site cautions that Chance should not be used for cryptographic applications requiring true randomness because it generates pseudo-random values.Read 10 Oct 2026 · chancejs.com
Seeded repeatability
Instances initialized with the same seed can produce the same sequence of random values.Read 10 Oct 2026 · chancejs.com
Unique values
The `unique()` helper builds an array of non-repeating generated items of a requested length.Read 10 Oct 2026 · chancejs.com

Plans and prices

Chance.js Free Open source · MIT License Read 10 Oct 2026 · chancejs.com

Every Chance.js plan and price →

Strong points and limits

Strong points

  • Covers many categories of generated data
  • Seeded instances can repeat output
  • Supports inclusive integer bounds
  • unique() creates non-repeating arrays
  • Free under the MIT License

Limits

  • Values are pseudorandom, not cryptographic
  • Name nationality options list English and Italian
  • Command-line use requires a separate package

Who it suits

It suits developers generating synthetic names, addresses, and other values for automated tests or sample data. Node.js, browser, and command-line users can choose the listed delivery modes.

Verdict

Chance.js offers broad synthetic-data generators with repeatable seeds and browser, Node.js, and CLI access. Its pseudorandom output is suitable for testing and sample data, not cryptographic randomness.

Where Specifiction places it

Alternatives to Chance.jsAll alternatives →