vm_total = ctx_vm(ctx_a)->total;
        GEM_BUG_ON(ctx_vm(ctx_b)->total != vm_total);
-       vm_total -= I915_GTT_PAGE_SIZE;
 
        count = 0;
        num_engines = 0;
                        u32 value = 0xc5c5c5c5;
                        u64 offset;
 
-                       div64_u64_rem(i915_prandom_u64_state(&prng),
-                                     vm_total, &offset);
-                       offset = round_down(offset, alignof_dword);
-                       offset += I915_GTT_PAGE_SIZE;
+                       /* Leave enough space at offset 0 for the batch */
+                       offset = igt_random_offset(&prng,
+                                                  I915_GTT_PAGE_SIZE, vm_total,
+                                                  sizeof(u32), alignof_dword);
 
                        err = write_to_scratch(ctx_a, engine,
                                               offset, 0xdeadbeef);