@Override
    public byte[] generate(long position) {
        int randPercent;
        synchronized (random) {
            random.setSeed(seed + position);
            randPercent = random.nextInt(100);
        }
        int curPercent = 0;
        RandomComponent com = components.get(0);
        for (RandomComponent component : components) {
            curPercent += component.percent();
            if (curPercent > randPercent) {
                com = component;
                break;
            }
        }
        return com.component().generate(position);
    }
A PayloadGenerator which generates pseudo-random payloads based on other PayloadGenerators.

Given a seed and non-null list of RandomComponents, RandomComponentPayloadGenerator
will use any given generator in its list of components a percentage of the time based on the 
percent field in the RandomComponent. These percent fields must be integers greater than 0 
and together add up to 100. The payloads generated can be reproduced from run to run.

An example of how to include this generator in a Trogdor taskSpec is shown below.
#{@code
   "keyGenerator": {
       "type": "randomComponent",
       "seed": 456,
       "components": [
         {
           "percent": 50,
           "component": {
             "type": "null"
           }
         },
         {
           "percent": 50,
           "component": {
             "type": "uniformRandom",
             "size": 4,
             "seed": 123,
             "padding": 0
           }
         }
       ]
   }
}
trogdor/src/main/java/org/apache/kafka/trogdor/workload/RandomComponentPayloadGenerator.java