procedural-word-generator
v1.0.1
Published
Generate word (meaningless word) from a given seed
Downloads
7
Maintainers
Readme
Procedural Word Generator
Generate a random word (not a meaningful word but random chars) from a given seed.
Install
npm i procedural-word-generator
Code Example
Import the package with,
const { WordGenerator } = require('procedural-word-generator');
The class WordGenerator
has these following properties and constructor.
/*
new WordGenerator(length?: number, seed?: number, prefixWord?: string);
*/
const word = new WordGenerator().word; // or <WordGenerator>.toString();
console.log(word) // a random word
With Provided Length
const word = new WordGenerator(7); //default length is 5
console.log(word.word); // a random 7 letter word
With Provided Seed
let seed = 56; // default seed is Date.now();
const word = new WordGenerator(4, seed);
console.log(word.word); // => gese
With Provided Prefix Word
let seed = 56;
let prefix = 'da'; // default is empty string
const word = new WordGenerator(4, seed, prefix);
console.log(word.word); // => darn