Skip to the content
Know your tech before you buy it. Makers: get listed from $49/mo

Chance.js

chancejs.com

  • Free plan
  • Web
  • API
7.4 Club score Visit chancejs.com

What Chance.js is

Chance.js is a free, open-source JavaScript library for generating synthetic random data, including strings, numbers, names, addresses, dates, financial values, and web-related values. It is intended for automated tests and other work that needs sample data. Developers can install it from npm for Node.js or load it in a browser, where they can use a global instance or create multiple instances. A separate chance-cli package makes generators available from the command line with options. Supplying a seed when creating an instance makes its output repeatable; instances initialized with the same seed can produce the same sequence. The integer generator accepts inclusive minimum and maximum bounds, and the `unique()` helper creates arrays without repeated generated items. Name generation documents English and Italian nationality options. Chance is released under the MIT License. Its values are pseudorandom, so its maker warns against using it for cryptographic applications that require true randomness.

Who it suits

Chance.js suits developers who need sample names, addresses, or other generated values for automated tests. It can also fit projects that need repeatable test data through seeded instances.

Good to know, and what to watch

  • Free and open source under the MIT License
  • Works in browsers and Node.js
  • Seeded instances can repeat their output
  • Includes a command-line package
  • Generators cover people, locations, finance, and web values
  • Values are pseudorandom, not for cryptographic use
  • Documented name nationality options are English and Italian

Chance.js

Free

Free plan

The verdict

Chance.js offers a broad set of generators for test data, with browser, Node.js, and command-line use. Its key boundary is clear: pseudorandom output is not intended for cryptographic applications requiring true randomness.

What the maker publishes

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

Checked against the maker's pages on 10 Oct 2026.