List of usage examples for org.apache.mahout.common RandomWrapper nextInt
@Override
public int nextInt(int n)
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*/ }