Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Chance.js – A Utility Library To Generate Anything Random For JavaScript

DZone's Guide to

Chance.js – A Utility Library To Generate Anything Random For JavaScript

· Web Dev Zone ·
Free Resource

Learn how error monitoring with Sentry closes the gap between the product team and your customers. With Sentry, you can focus on what you do best: building and scaling software that makes your users’ lives better.

Chance.js is a JavaScript library for generating random data, be it numbers, strings, boolean, etc. The library was written to alleviate the monotony of automated testing, which needed randomness.

However, you can use Chance.js for all your other random needs. Chance.js can generate random value for all the common data types like: bool, character, floating, integer, natural and string.

Chance.js can also generate random text like: paragraph, sentence, syllable and word. Check out the Chance.js website to get a full description of the various type of random data the library can generate. Below is a list of the different data type:

  • Text: paragraph, sentence, syllable, word.
  • Person: age, birthday, first, gender, last name, prefix.
  • Web: color, domain, email, fbid, google_analytics, hashtag, ip, ipv6, klout, tld, twitter.
  • Address: address, areacode, city, coordinates, latitude, longitude, phone, postal, province, radio, state, street, tv, zip.
  • Time: ampm, date, hammertime, hour, millisecond, minute, month, second, timestamp, year.
  • Finance: cc, cc_type, dollar, exp, exp_month, exp_year.

Requirements: None
Demo: http://chancejs.com/
License: MIT License

 

What’s the best way to boost the efficiency of your product team and ship with confidence? Check out this ebook to learn how Sentry's real-time error monitoring helps developers stay in their workflow to fix bugs before the user even knows there’s a problem.

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}