diff --git a/jstests/concurrency/fsm_workloads/collection_defragmentation.js b/jstests/concurrency/fsm_workloads/collection_defragmentation.js
index 8595d8cdadc..e73773ef925 100644
--- a/jstests/concurrency/fsm_workloads/collection_defragmentation.js
+++ b/jstests/concurrency/fsm_workloads/collection_defragmentation.js
@@ -205,14 +205,14 @@ var $config = (function() {
                 const fullNs = dbName + "." + collPrefix + j;
                 const numChunks = Random.randInt(30);
                 const numZones = Random.randInt(numChunks / 2);
-                const docSizeBytes = Random.randInt(1024 * 1024) + 50;
+                const docSizeBytesRange = [50, 1024 * 1024];
                 defragmentationUtil.createFragmentedCollection(
                     mongos,
                     fullNs,
                     numChunks,
                     5 /* maxChunkFillMB */,
                     numZones,
-                    docSizeBytes,
+                    docSizeBytesRange,
                     1000 /* chunkSpacing */,
                     true /* disableCollectionBalancing*/);
             }
diff --git a/jstests/sharding/balancer_defragmentation_merge_chunks.js b/jstests/sharding/balancer_defragmentation_merge_chunks.js
index bb53e575997..8be88439315 100644
--- a/jstests/sharding/balancer_defragmentation_merge_chunks.js
+++ b/jstests/sharding/balancer_defragmentation_merge_chunks.js
@@ -71,7 +71,7 @@ function setupCollection() {
                                                    10 /* numChunks */,
                                                    targetChunkSizeMB / 2 /* maxChunkFillMB */,
                                                    0 /* numZones */,
-                                                   32 * 1024 /* docSizeBytes */,
+                                                   [32 * 1024, 32 * 1024] /* docSizeBytesRange */,
                                                    1000 /* chunkSpacing */,
                                                    false /* disableCollectionBalancing */);
     jsTest.log("Collection " + coll.getFullName() + ", number of chunks before defragmentation: " +
diff --git a/jstests/sharding/defragment_large_collection.js b/jstests/sharding/defragment_large_collection.js
index beea51aafe5..ebca6e24033 100644
--- a/jstests/sharding/defragment_large_collection.js
+++ b/jstests/sharding/defragment_large_collection.js
@@ -40,7 +40,7 @@ let runTest = function(numCollections, dbName) {
     for (let i = 0; i < numCollections; ++i) {
         const numChunks = Random.randInt(28) + 2;
         const numZones = Random.randInt(numChunks / 2);
-        const docSizeBytes = Random.randInt(1024 * 1024) + 50;
+        const docSizeBytesRange = [50, 1024 * 1024];
 
         const coll = db[coll_prefix + i];
 
@@ -49,7 +49,7 @@ let runTest = function(numCollections, dbName) {
                                                        numChunks,
                                                        maxChunkFillMB,
                                                        numZones,
-                                                       docSizeBytes,
+                                                       docSizeBytesRange,
                                                        chunkSpacing,
                                                        true);
 
diff --git a/jstests/sharding/libs/defragmentation_util.js b/jstests/sharding/libs/defragmentation_util.js
index e9c71aa2de8..b7efe5a82b8 100644
--- a/jstests/sharding/libs/defragmentation_util.js
+++ b/jstests/sharding/libs/defragmentation_util.js
@@ -7,11 +7,12 @@ var defragmentationUtil = (function() {
                                               numChunks,
                                               maxChunkFillMB,
                                               numZones,
-                                              docSizeBytes,
+                                              docSizeBytesRange,
                                               chunkSpacing,
                                               disableCollectionBalancing) {
-        jsTest.log("Creating fragmented collection " + ns + " with parameters: numChunks = " +
-                   numChunks + ", numZones = " + numZones + ", docSizeBytes = " + docSizeBytes +
+        jsTest.log("Creating fragmented collection " + ns +
+                   " with parameters: numChunks = " + numChunks + ", numZones = " + numZones +
+                   ", docSizeBytesRange = " + docSizeBytesRange +
                    ", maxChunkFillMB = " + maxChunkFillMB + ", chunkSpacing = " + chunkSpacing);
         assert.commandWorked(mongos.adminCommand({shardCollection: ns, key: {key: 1}}));
         // Turn off balancer for this collection
@@ -28,7 +29,7 @@ var defragmentationUtil = (function() {
         // Created zones will line up exactly with existing chunks so as not to trigger zone
         // violations in the balancer.
         createRandomZones(mongos, ns, numZones);
-        fillChunksToRandomSize(mongos, ns, docSizeBytes, maxChunkFillMB);
+        fillChunksToRandomSize(mongos, ns, docSizeBytesRange, maxChunkFillMB);
 
         const beginningNumberChunks = findChunksUtil.countChunksForNs(mongos.getDB('config'), ns);
         const beginningNumberZones = mongos.getDB('config').tags.countDocuments({ns: ns});
@@ -72,13 +73,15 @@ var defragmentationUtil = (function() {
         }
     };
 
-    let fillChunksToRandomSize = function(mongos, ns, docSizeBytes, maxChunkFillMB) {
+    let fillChunksToRandomSize = function(mongos, ns, docSizeBytesRange, maxChunkFillMB) {
         const chunks = findChunksUtil.findChunksByNs(mongos.getDB('config'), ns).toArray();
-        const bigString = "X".repeat(docSizeBytes);
         const coll = mongos.getCollection(ns);
         let bulk = coll.initializeUnorderedBulkOp();
         chunks.forEach((chunk) => {
             let chunkSize = Random.randInt(maxChunkFillMB);
+            let docSizeBytes = Random.randInt(docSizeBytesRange[1] - docSizeBytesRange[0] + 1) +
+                docSizeBytesRange[0];
+            let bigString = "X".repeat(docSizeBytes);
             let docsPerChunk = (chunkSize * 1024 * 1024) / docSizeBytes;
             if (docsPerChunk === 0) {
                 return;
