Example usage for org.apache.mahout.common RandomWrapper nextInt

List of usage examples for org.apache.mahout.common RandomWrapper nextInt

Introduction

In this page you can find the example usage for org.apache.mahout.common RandomWrapper nextInt.

Prototype

@Override
    public int nextInt(int n) 

Source Link

Usage

From source file:com.predictionmarketing.itemrecommend.RatingSGDFactorizer.java

License:Apache License

protected void shufflePreferences() {
    RandomWrapper random = RandomUtils.getRandom();
    /* Durstenfeld shuffle */
    for (int currentPos = cachedUserIDs.length - 1; currentPos > 0; currentPos--) {
        int swapPos = random.nextInt(currentPos + 1);
        swapCachedPreferences(currentPos, swapPos);
    }/* w  ww . j av  a  2 s  .co  m*/
}

From source file:org.codelibs.elasticsearch.taste.recommender.svd.RatingSGDFactorizer.java

License:Apache License

protected void shufflePreferences() {
    final RandomWrapper random = RandomUtils.getRandom();
    /* Durstenfeld shuffle */
    for (int currentPos = cachedUserIDs.length - 1; currentPos > 0; currentPos--) {
        final int swapPos = random.nextInt(currentPos + 1);
        swapCachedPreferences(currentPos, swapPos);
    }/*  w  ww . j a va 2 s . c o m*/
}