Reputation: 125
I am trying to populate around 10000 rows in my database in a java application. I am able to choose random firstNames, LastNames etc. I have set of 60 {Departmentid, Managerid} combinations. I have to randomly assign this set to those 10,000 employees. Every employee should have a legitimate Departmentid and Managerid combination.
How should I approach this? Any help is appreciated.
Upvotes: 0
Views: 87
Reputation: 612
If your departmentId or managerids are stored in arrays, you can use the java.util.Random
departmentid[new Random().nextInt(60)]
where nextInt(int upperbound) will help randomize the entries.
Upvotes: 2
Reputation: 3870
Hashing is the easiest way. Create a hash of combination of first and last name. Now take a random hash and find the employee for that hash and assign whatever u want
Upvotes: 1