I am working on a Java application for which I am trying to add random data to the database. I managed to add random variables like Names, etc. But there is functionality in the project which is tied to actual country-code, cities, birthdays.
Unfortunately, I cannot find anything which will help me generate all this values which exist in real world.
I tried adding birthday, but get out of range failure for that.
Code :
@Override
public void addRandom() {
int minimum = 1000;
int maxValue = 2000;
for(int i = 0; i< 1000; i++){
student.setCity(new BigInteger(130, random).toString(32));
student.setCountry(new BigInteger(130, random).toString(32));
student.setDesiredCity(new BigInteger(130, random).toString(32));
student.setDesiredCountry(new BigInteger(130, random).toString(32));
if(getRandomBoolean()){
student.setGender("male");
}else {
student.setGender("female");
}
// student.setStudentBirthday(new Date(Math.abs(System.currentTimeMillis() - RandomUtils.nextLong())));
}
Thank you.
Aucun commentaire:
Enregistrer un commentaire