changed randomly generated samples to randomly selected from the dictionary content

dev
Paul Cruz 2017-06-14 16:42:51 -07:00
parent 3b0e24c06b
commit 664ed05ff6
1 changed files with 16 additions and 1 deletions

View File

@ -1352,7 +1352,22 @@ static int generateCorpusWithDict(U32 seed, unsigned numFiles, const char* const
curr++;
}
samples = malloc(totalSize);
RAND_buffer(&seed, samples, totalSize);
/* reset pointer and counter */
curr = sampleSizes;
i = 0;
{
/* take substring from dictionary content */
size_t pos = 0;
const BYTE* endDict = dictContent + dictSize - 400;
while(i++ < numSamples){
size_t currSize = *(curr++);
BYTE* startSubstring = endDict - currSize;
memcpy(samples + pos, (void*)startSubstring, currSize);
pos += currSize;
}
}
}
{