public Date randomDate(){
  if (random.nextInt(10) == 0) {
    return null;
  }
  StringBuilder buff=new StringBuilder();
  buff.append(getInt(10) + 2000);
  buff.append('-');
  int month=getInt(12) + 1;
  if (month < 10) {
    buff.append('0');
  }
  buff.append(month);
  buff.append('-');
  int day=getInt(28) + 1;
  if (day < 10) {
    buff.append('0');
  }
  buff.append(day);
  return Date.valueOf(buff.toString());
}

public Date randomDate ( ) { if ( random . nextInt ( 10 ) == 0 ) { return null ; } StringBuilder buff = new StringBuilder ( ) ; buff . append ( getInt ( 10 ) + 2000 ) ; buff . append ( '-' ) ; int month = getInt ( 12 ) + 1 ; if ( month < 10 ) { buff . append ( '0' ) ; } buff . append ( month ) ; buff . append ( '-' ) ; int day = getInt ( 28 ) + 1 ; if ( day < 10 ) { buff . append ( '0' ) ; } buff . append ( day ) ; return Date . valueOf ( buff . toString ( ) ) ; }
get a random date value . in 10 % of the cases , null is returned .
