1.0.3 • Published 6 months ago

random-data-class v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

Generate random content (int, char, word, sentence)

Install:

npm i random-data-class

Usage:

import RandomData from "random-data-class";
const rnd = new RandomData();

Get random char in specified language

  • @param language Language of char (english, russian) Default - english.
console.log(rnd.getRandomChar());

Get word in specified language

  • @param minlengthOfWord min letters
  • @param maxLengthOfWord max letters
  • @param language Language of word (english, russian) Default - english.
console.log(rnd.getRandomWord(4, 8));

Get random sentence

  • @param minNumberOfWords = 1,
  • @param maxNumberOfWords = 5,
  • @param language = "english")
console.log(rnd.getRandomSentence());

Get random int number (min and max inclusive)

  • If only 1 argument - then this is max.
  • If no arguments then min=0, max=10
  • @param min minimum or maximum number (not required)
  • @param max maximum number (not required)
  • @returns {number} Random int from min to max inclusive
console.log(rnd.getRandomInt());