createWord static method

String createWord([
  1. int numWords = 1
])

Creates numWords number of random words.

Implementation

static String createWord([int numWords = 1]) {
  Random random;

  if (numWords > 1) {
    return createSentence(sentenceLength: numWords, numSentences: 1);
  }

  random = Random();
  return words[random.nextInt(words.length)];
}