mirror of
https://github.com/facebook/zstd.git
synced 2025-07-30 22:23:13 +03:00
add question marks
and (slightly) longer sentences.
This commit is contained in:
@ -160,8 +160,10 @@ static int about(unsigned target)
|
|||||||
/* Function to generate a random sentence */
|
/* Function to generate a random sentence */
|
||||||
static void generateSentence(int nbWords)
|
static void generateSentence(int nbWords)
|
||||||
{
|
{
|
||||||
int commaPos = about(9);
|
int commaPos = about(9);
|
||||||
int comma2 = commaPos + about(7);
|
int comma2 = commaPos + about(7);
|
||||||
|
int qmark = (LOREM_rand(11) == 7);
|
||||||
|
const char* endSep = qmark ? "? " : ". ";
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < nbWords; i++) {
|
for (i = 0; i < nbWords; i++) {
|
||||||
int const wordID = distrib[LOREM_rand(distribCount)];
|
int const wordID = distrib[LOREM_rand(distribCount)];
|
||||||
@ -172,7 +174,7 @@ static void generateSentence(int nbWords)
|
|||||||
if (i == comma2)
|
if (i == comma2)
|
||||||
sep = ", ";
|
sep = ", ";
|
||||||
if (i == nbWords - 1)
|
if (i == nbWords - 1)
|
||||||
sep = ". ";
|
sep = endSep;
|
||||||
generateWord(word, sep, i == 0);
|
generateWord(word, sep, i == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,7 +183,7 @@ static void generateParagraph(int nbSentences)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < nbSentences; i++) {
|
for (i = 0; i < nbSentences; i++) {
|
||||||
int wordsPerSentence = about(8);
|
int wordsPerSentence = about(10);
|
||||||
generateSentence(wordsPerSentence);
|
generateSentence(wordsPerSentence);
|
||||||
}
|
}
|
||||||
if (g_nbChars < g_maxChars) {
|
if (g_nbChars < g_maxChars) {
|
||||||
|
Reference in New Issue
Block a user