public static HiveChar getRandHiveChar(Random r, CharTypeInfo charTypeInfo, boolean isUnicodeOk) {
    final int maxLength = 1 + r.nextInt(charTypeInfo.getLength());
    final String randomString = getRandString(r, 100, isUnicodeOk);
    return new HiveChar(randomString, maxLength);
  }
Generate object inspector and random row object[].
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/VectorRandomRowSource.java