Random programming in java