words function
Returns a generator that produces between min and max (inclusive)
lowercase lorem words joined by a space on each call.
Throws ArgumentError if min is less than 1 or max is less than
min.
Implementation
TValueGenerator words({
required Random random,
int min = 1,
int max = 3,
}) {
_requirePositive(min, 'min');
if (max < min) {
throw ArgumentError('max ($max) must be >= min ($min)');
}
return () {
final count = min == max ? min : min + random.nextInt(max - min + 1);
return _generateWords(random, count);
};
}