Package edu.brown.rand.RandomDistribution

Examples of edu.brown.rand.RandomDistribution.Zipf


          assert(txns.getSampleCount() == 100) : txns;
          this.rand_gen = new Random();
          long articlesSize = Math.round(ArticlesConstants.ARTICLES_SIZE * this.getScaleFactor());
          long usersSize = Math.round(ArticlesConstants.USERS_SIZE * this.getScaleFactor());

          this.readRecord = new Zipf(this.rand_gen, 0,
                    articlesSize, 1.0001);
          this.userRecord = new Zipf(this.rand_gen, 0, usersSize, 1.0001);

          this.txnWeights = new FlatHistogram<Transaction>(this.rand_gen, txns);
      }
View Full Code Here


       
        public UserGenerator() {
            super(AuctionMarkConstants.TABLENAME_USER,
                  AuctionMarkConstants.TABLENAME_REGION);
            this.randomRegion = new Flat(profile.rng, 0, (int) AuctionMarkConstants.TABLESIZE_REGION);
            this.randomRating = new Zipf(profile.rng, AuctionMarkConstants.USER_MIN_RATING,
                                                                     AuctionMarkConstants.USER_MAX_RATING, 1.0001);
            this.randomBalance = new Zipf(profile.rng, AuctionMarkConstants.USER_MIN_BALANCE,
                                                                      AuctionMarkConstants.USER_MAX_BALANCE, 1.001);
        }
View Full Code Here

        @Override
        public void init() {
            // Populate the profile's users per item count histogram so that we know how many
            // items that each user should have. This will then be used to calculate the
            // the user ids by placing them into numeric ranges
            Zipf randomNumItems = new Zipf(profile.rng,
                                           AuctionMarkConstants.ITEM_MIN_ITEMS_PER_SELLER,
                                           Math.round(AuctionMarkConstants.ITEM_MAX_ITEMS_PER_SELLER * profile.getScaleFactor()),
                                           1.001);
            for (long i = 0; i < this.tableSize; i++) {
                long num_items = randomNumItems.nextInt();
                profile.users_per_item_count.put(num_items);
            } // FOR
            if (trace.val)
                LOG.trace("Users Per Item Count:\n" + profile.users_per_item_count);
            this.idGenerator = new UserIdGenerator(profile.users_per_item_count, getNumClients());
View Full Code Here

       
        public UserAttributesGenerator() {
            super(AuctionMarkConstants.TABLENAME_USER_ATTRIBUTES,
                  AuctionMarkConstants.TABLENAME_USER);
           
            this.randomNumUserAttributes = new Zipf(profile.rng,
                                                    AuctionMarkConstants.USER_MIN_ATTRIBUTES,
                                                    AuctionMarkConstants.USER_MAX_ATTRIBUTES, 1.001);
        }
View Full Code Here

           
            // Loop through for the total customers and figure out how many entries we
            // should have for each one. This will be our new total;
            long max_per_customer = Math.min(Math.round(SEATSConstants.CUSTOMER_NUM_FREQUENTFLYERS_MAX * Math.max(1, getScaleFactor())),
                                             flights_per_airline.getValueCount());
            Zipf ff_zipf = new Zipf(rng, SEATSConstants.CUSTOMER_NUM_FREQUENTFLYERS_MIN,
                                         max_per_customer,
                                         SEATSConstants.CUSTOMER_NUM_FREQUENTFLYERS_SIGMA);
            long new_total = 0;
            if (debug.val) LOG.debug("Num of Customers: " + num_customers);
            this.ff_per_customer = new short[(int)num_customers];
            for (int i = 0; i < num_customers; i++) {
                this.ff_per_customer[i] = (short)ff_zipf.nextInt();
                if (this.ff_per_customer[i] > max_per_customer)
                    this.ff_per_customer[i] = (short)max_per_customer;
                new_total += this.ff_per_customer[i];
            } // FOR
            this.total = new_total;
View Full Code Here

            TimestampType startDate = this.getRandomStartTimestamp(endDate);
           
            //LOG.info("endDate = " + endDate + " : startDate = " + startDate);
            long bidDurationDay = ((endDate.getTime() - startDate.getTime()) / AuctionMarkConstants.MICROSECONDS_IN_A_DAY);
            if (this.item_bid_watch_zipfs.containsKey(bidDurationDay) == false) {
                Zipf randomNumBids = new Zipf(profile.rng,
                        AuctionMarkConstants.ITEM_MIN_BIDS_PER_DAY * (int)bidDurationDay,
                        AuctionMarkConstants.ITEM_MAX_BIDS_PER_DAY * (int)bidDurationDay,
                        1.001);
                Zipf randomNumWatches = new Zipf(profile.rng,
                        AuctionMarkConstants.ITEM_MIN_WATCHES_PER_DAY * (int)bidDurationDay,
                        (int)Math.ceil(AuctionMarkConstants.ITEM_MAX_WATCHES_PER_DAY * (int)bidDurationDay * profile.getScaleFactor()), 1.001);
                this.item_bid_watch_zipfs.put(bidDurationDay, Pair.of(randomNumBids, randomNumWatches));
            }
            Pair<Zipf, Zipf> p = this.item_bid_watch_zipfs.get(bidDurationDay);
View Full Code Here

        this.h_nameLength = new FlatHistogram<Integer>(this.rand, UserHistograms.NAME_LENGTH);
        this.h_realNameLength = new FlatHistogram<Integer>(this.rand, UserHistograms.REAL_NAME_LENGTH);
        this.h_revCount = new FlatHistogram<Integer>(this.rand, UserHistograms.REVISION_COUNT);
        this.h_titleLength = new FlatHistogram<Integer>(this.rand, PageHistograms.TITLE_LENGTH);
        this.h_restrictions = new FlatHistogram<String>(this.rand, PageHistograms.RESTRICTIONS);
        this.h_watchPageCount = new Zipf(this.rand, 0, this.num_pages, WikipediaConstants.NUM_WATCHES_PER_USER_SIGMA);
        this.h_watchPageId = new Zipf(this.rand, 1, this.num_pages, WikipediaConstants.WATCHLIST_PAGE_SIGMA);
        this.h_commentLength = new FlatHistogram<Integer>(this.rand, RevisionHistograms.COMMENT_LENGTH);
        this.h_minorEdit = new FlatHistogram<Integer>(this.rand, RevisionHistograms.MINOR_EDIT);
    }
View Full Code Here

        } // FOR
       
        this.util = new WikipediaUtil(this.randGenerator, this.getScaleFactor());
       
        this.flat_users = new Flat(this.randGenerator, 1, util.num_users);
        this.zipf_pages = new Zipf(this.randGenerator, 1, util.num_pages, WikipediaConstants.USER_ID_SIGMA);
        this.flat_pages = new Flat(this.randGenerator, 1, util.num_pages);
    }
View Full Code Here

              txns.put(t, weight);
          } // FOR
          assert(txns.getSampleCount() == 100) : txns;
          this.rand_gen = new Random();
          this.usersSize = Math.round(UsersConstants.USERS_SIZE * this.getScaleFactor());
          this.userRecord = new Zipf(this.rand_gen, 0, usersSize, 1.0001);

          this.txnWeights = new FlatHistogram<Transaction>(this.rand_gen, txns);
      }
View Full Code Here

        VoltTable vtRev = CatalogUtil.getVoltTable(revTable);
        int num_txt_cols = textTable.getColumns().size();
        int num_rev_cols = revTable.getColumns().size();
        int batchSize = 1;
       
        Zipf h_users = new Zipf(this.randGenerator, 1, util.num_users, WikipediaConstants.REVISION_USER_SIGMA);
        FlatHistogram<Integer> h_textLength = new FlatHistogram<Integer>(this.randGenerator, TextHistograms.TEXT_LENGTH);
        FlatHistogram<Integer> h_nameLength = new FlatHistogram<Integer>(this.randGenerator, UserHistograms.NAME_LENGTH);
        FlatHistogram<Integer> h_numRevisions = new FlatHistogram<Integer>(this.randGenerator, PageHistograms.REVISIONS_PER_PAGE);
       
        int lastPercent = -1;
        for (int pageId = firstPageId; pageId <= lastPageId; pageId++) {
            // There must be at least one revision per page
            int num_revised = h_numRevisions.nextValue().intValue();
           
            // Generate what the new revision is going to be
            int old_text_length = h_textLength.nextValue().intValue();
            if (trace.val) LOG.trace("Max length:" + max_text_length + " old_text_length:" + old_text_length);
            assert(old_text_length > 0);
            assert(old_text_length < max_text_length);
            char old_text[] = TextGenerator.randomChars(randGenerator, old_text_length);
            long batchBytes = 0;
           
            for (int i = 0; i < num_revised; i++) {
                // Generate the User who's doing the revision and the Page revised
                // Makes sure that we always update their counter
                int user_id = h_users.nextInt();
                assert(user_id > 0 && user_id <= util.num_users) : "Invalid UserId '" + user_id + "'";
                this.user_revision_ctr[user_id-1]++;
                TimestampType timestamp = new TimestampType();
               
                // Generate what the new revision is going to be
View Full Code Here

TOP

Related Classes of edu.brown.rand.RandomDistribution.Zipf

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.