diff --git a/tests/decodecorpus.c b/tests/decodecorpus.c
index ec826b0..96799f8 100644
--- a/tests/decodecorpus.c
+++ b/tests/decodecorpus.c
@@ -1347,47 +1347,47 @@
         unsigned numSamples = 0;
         BYTE* samples;
         unsigned i = 0;
-        size_t* sampleSizes = malloc(numSamples*sizeof(size_t));
+        size_t* sampleSizes = malloc(255*sizeof(size_t));
         {
             size_t* curr = sampleSizes;
             size_t totalSize = 0;
-            while(numSamples < 100){
-                unsigned numReps = ROUND(RAND_exp(&seed, 10));
+            unsigned numReps = 1;
+            while(numSamples < 200){
                 size_t randSize = RAND(&seed) % dictContentSize;
+                unsigned counter = numReps;
                 numSamples += numReps;
-                while(numReps-- > 0){
+                while(counter-- > 0){
                     *curr = randSize;
                     totalSize += *curr;
                     curr++;
                 }
+                numReps *= 2;
             }
             samples = malloc(totalSize);
 
             /* reset pointer and counter */
             curr = sampleSizes;
             i = 0;
-            DISPLAY("total size: %zu\n", totalSize);
             {
                 /* take substring from dictionary content */
                 size_t pos = 0;
                 BYTE* endDict = dictContent + dictContentSize;
                 while(i++ < numSamples){
                     size_t currSize = *(curr++);
-                    DISPLAY("current size: %zu\n", currSize);
-                    DISPLAY("dictionary content size: %zu\n", dictContentSize);
                     BYTE* startSubstring = endDict - currSize;
                     memcpy(samples + pos, (void*)startSubstring, currSize);
                     pos += currSize;
                 }
             }
         }
+        DISPLAY("==================done with generation====================\n");
         {
             /* set dictionary params */
             ZDICT_params_t zdictParams;
             memset(&zdictParams, 0, sizeof(zdictParams));
             zdictParams.dictID = dictID;
             zdictParams.notificationLevel = 1;
-
+            DISPLAY("===================zdict params================\n");
             /* finalize dictionary with random samples */
             dictWriteSize = ZDICT_finalizeDictionary(fullDict, dictSize,
                                         dictContent, dictContentSize,
@@ -1399,7 +1399,7 @@
             DISPLAY("Could not finalize dictionary: %s\n", ZDICT_getErrorName(dictWriteSize));
             return 1;
         }
-
+        DISPLAY("=================done with finalize=================\n");
         /* write out dictionary */
         if(snprintf(outPath, MAX_PATH, "%s/dictionary", path) + 1 > MAX_PATH){
             DISPLAY("Error: dictionary path too long\n");
@@ -1442,7 +1442,7 @@
                                                fullDict, dictSize);
 
         if(ZSTD_isError(returnValue)){
-            DISPLAY("Error: %s", ZSTD_getErrorName(returnValue));
+            DISPLAY("Error: %s\n", ZSTD_getErrorName(returnValue));
         }
 
     }
