remove shuffle and replace with random index call to improve performance
This commit is contained in:
@@ -151,8 +151,11 @@ public class Faker {
|
||||
// lorem
|
||||
public List<String> words(int num) {
|
||||
List<String> words = (List<String>) fetchObject("lorem.words");
|
||||
Collections.shuffle(words);
|
||||
return words.subList(0, num);
|
||||
List<String> returnList = new ArrayList();
|
||||
for (int i=0; i< num;i++) {
|
||||
returnList.add(words.get(nextInt(words.size())));
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
public List<String> words() {
|
||||
|
||||
Reference in New Issue
Block a user