Web Analytics Made
      Easy - StatCounter

get Random Words

What it does?

A script to get any number of random words from any category you choose!

The function 'getRandomWords()' returns an array of string with the length less than or equal to your given count.

Size:

1. The minified version is of size 14kB.
2. The beautified version is of size 48kB. 

How to use?

  • Step 1

    Copy the below code and paste it between the <head></head> tag of html.

    <script src="https://outdatedguy.rocks/libs/script/getRandomWords/1.0.0/words.min.js"></script>
  • Step 2

    Call the function getRandomWords() within console.log() to check if it is working.

    console.log(getRandomWords());
  • Step 3

    Pass in an object with properties count, repeat and category to get words of your choice.

    getRandomWords({ count: 10, category: "Animals"});
  • NOTE
    • Values

      1. count MUST be a 'number' (the number of words to return) (1 by default)
      2. category MUST be a 'string' (the category of words to return) (randomly selected by default)
      3. repeat MUST be a 'boolean' (to have re-occurring words) (false by default)

    • Options

      category at this time supports:

      1. Animals
      2. Colors
      3. Food
      4. Peoples
      5. Sports
    • Conditions of count

      1. Categories are further divided into types to get words with strong relation to each other. If the given count is greater than the type with the highest count, then an array with the length of 80% of size of selected category or given count is returned, except when repeat is 'true'.

      2. If the given count is greater than 80% of the size of the selected category, then only 80% of the size of that category is returned (due to re-appearing words), except when repeat is 'true'.