Randomize document insertion in tests