Skip to content

Commit 59d0032

Browse files
committed
Eliminate duplicate email addresses. Fixes #388
1 parent 2131160 commit 59d0032

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/ldbc/snb/datagen/generator/generators/PersonGenerator.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,14 @@ private Person generatePerson() {
151151
base = base.replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
152152
base = base.replaceAll(" ", ".");
153153
base = base.replaceAll("[.]+", ".");
154-
for (int i = 0; i < numEmails; i++) {
154+
while (person.getEmails().size() < numEmails) {
155155
String email = base + "" + person.getAccountId() + "@" +
156156
Dictionaries.emails.getRandomEmail(randomFarm.get(RandomGeneratorFarm.Aspect.TOP_EMAIL),
157157
randomFarm.get(RandomGeneratorFarm.Aspect.EMAIL));
158-
person.getEmails().add(email);
158+
// avoid duplicates
159+
if (!person.getEmails().contains(email)) {
160+
person.getEmails().add(email);
161+
}
159162
}
160163

161164
// Set class year

0 commit comments

Comments
 (0)