goog.text.LoremIpsum
Classgoog.text.LoremIpsum()
Generates random strings of "lorem ipsum" text, based on the word distribution of a sample text, using the words in a dictionary.
.arrayLength_(array)
Returns the length of an array. Written as a function so it can be used as a function parameter.
array
{Array
}
number
}
.chooseClosest(values, target)
Find the number in the list of values that is closest to the target.
values
{Array
.<number
>}
target
{number
}
number
}
.dictionary_
{string
}Dictionary of words.
.generateParagraph(opt_startWithLorem)
Generates a single lorem ipsum paragraph, of random length.
opt_startWithLorem
{boolean
}
string
}
.generateSentence(opt_startWithLorem)
Generates a single sentence, of random length.
opt_startWithLorem
{boolean
}
string
}
.initializeDictionary_(dictionary)
Sets the generator to use a given selection of words for generating sentences with.
dictionary
{string
}
.randomChoice_(array)
Picks a random element of the array.
array
{Array
}
.sample_
{string
}Sample that the generated text is based on .
.starts_
{Array
}Pairs of word-lengths that can appear at the beginning of sentences.