Code example for Random

  private static final String VALUE = "value";
  private FileSystem fs;
  private Configuration conf;
  private Path path;
  private Random random = new Random();
  private String comparator = "memcmp";
  private String outputFile = "TestTFileSplit";
  void createFile(int count, String compress) throws IOException {
    conf = new Configuration();
    path = new Path(ROOT, outputFile + "." + compress);
    fs = path.getFileSystem(conf);
    FSDataOutputStream out = fs.create(path);
    Writer writer = new Writer(out, BLOCK_SIZE, compress, comparator, conf);
    int nx;
    for (nx = 0; nx < count; nx++) {
      byte[] key = composeSortedKey(KEY, count, nx).getBytes();
Connect your IDE to all the code out there  Get Codota for Java