public Object nextObject(Random rnd,int type,boolean allowNull){
  Object obj=null;
switch (type) {
case BOOLEAN:
{
      obj=(rnd.nextBoolean() ? Boolean.TRUE : Boolean.FALSE);
      break;
    }
case BYTE:
{
    obj=Byte.valueOf((byte)(rnd.nextInt(255) - 127));
    break;
  }
case CHAR:
{
  obj=Character.valueOf(alphabet.charAt(rnd.nextInt(alphabet.length())));
  break;
}
case SHORT:
{
obj=Short.valueOf((short)rnd.nextInt());
break;
}
case INT:
{
obj=Integer.valueOf(rnd.nextInt());
break;
}
case LONG:
{
obj=Long.valueOf(rnd.nextLong());
break;
}
case FLOAT:
{
obj=Float.valueOf(rnd.nextFloat());
break;
}
case DOUBLE:
{
obj=Double.valueOf(rnd.nextDouble());
break;
}
case STRING:
{
obj=getRandomString(40,rnd.nextInt());
break;
}
case OBJECT:
{
obj=getRandomString(40,rnd.nextInt());
break;
}
default :
{
throw new AssertionError("unknown type=" + type);
}
}
return obj;
}

public Object nextObject ( Random rnd , int type , boolean allowNull ) { Object obj = null ; switch ( type ) { case BOOLEAN : { obj = ( rnd . nextBoolean ( ) ? Boolean . TRUE : Boolean . FALSE ) ; break ; } case BYTE : { obj = Byte . valueOf ( ( byte ) ( rnd . nextInt ( 255 ) - 127 ) ) ; break ; } case CHAR : { obj = Character . valueOf ( alphabet . charAt ( rnd . nextInt ( alphabet . length ( ) ) ) ) ; break ; } case SHORT : { obj = Short . valueOf ( ( short ) rnd . nextInt ( ) ) ; break ; } case INT : { obj = Integer . valueOf ( rnd . nextInt ( ) ) ; break ; } case LONG : { obj = Long . valueOf ( rnd . nextLong ( ) ) ; break ; } case FLOAT : { obj = Float . valueOf ( rnd . nextFloat ( ) ) ; break ; } case DOUBLE : { obj = Double . valueOf ( rnd . nextDouble ( ) ) ; break ; } case STRING : { obj = getRandomString ( 40 , rnd . nextInt ( ) ) ; break ; } case OBJECT : { obj = getRandomString ( 40 , rnd . nextInt ( ) ) ; break ; } default : { throw new AssertionError ( "unknown type=" + type ) ; } } return obj ; }
return an instance of the specified type with a random value .
