Code example for Random

0
 * @author dennis<killme2008@gmail.com> 
 *  
 */ 
public class RandomPartitionSelector extends AbstractPartitionSelector { 
 
    final Random rand = new Random();
 
 
    @Override 
    public Partition getPartition0(String topic, List<Partition> partitions, Message message)
            throws MetaClientException { 
        return partitions.get(this.rand.nextInt(partitions.size()));
    } 
 
}