com.github.diceproject.qt.util.ExponentialDistribution Maven / Gradle / Ivy
package com.github.diceproject.qt.util;
//author: yifan
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Random;
public class ExponentialDistribution {
public static int totalNum=0;
public static ArrayList preExponentialList;
public static ArrayList exponentialList;
public static Random random;
public static ArrayList randomExponentialDistribution(int scale, int range)
{
random = new Random();
exponentialList=new ArrayList();
preExponentialList=new ArrayList();
try {
for(int i=0; i=1000) break;
exponentialList.add(totalNum);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Collections.sort(exponentialList, new Comparator() {
@Override
public int compare(Integer o1, Integer o2) {
// TODO Auto-generated method stub
return o1.compareTo(o2);
}
});
return exponentialList;
}
}