if (file == null || b.getTraceSize() == 0) return (null);
assert(this.num_pages == this.titles.size());
LOG.info(String.format("Generating a %dk traces to '%s'", b.getTraceSize(), file));
Flat z_users = new Flat(rng(), 1, this.num_users);
Zipf z_pages = new Zipf(rng(), 1, this.num_pages, WikipediaConstants.USER_ID_SIGMA);
PrintStream ps = new PrintStream(file);
for (int i = 0, cnt = (b.getTraceSize() * 1000); i < cnt; i++) {
int user_id = -1;
// Check whether this should be an anonymous update
if (rng().nextInt(100) < WikipediaConstants.ANONYMOUS_PAGE_UPDATE_PROB) {
user_id = WikipediaConstants.ANONYMOUS_USER_ID;
}
// Otherwise figure out what user is updating this page
else {
user_id = z_users.nextInt();
}
assert(user_id != -1);
// Figure out what page they're going to update
int page_id = z_pages.nextInt();