I am trying to generate Mersenne Twister generator but I always have this massage "MersenneTwister cannot be resolved to a type" This is my code
public class RandomVariable
{
/** Initialize Mersenne Twister generator. */
private static MersenneTwister rnd = new MersenneTwister();
/** Generate a uniformly distributed random number between 0 and 1.
*
* @return A double between 0 and 1.
*
* </p>
*/
public static double rand()
{
return rnd.nextDouble();
}
}
You need to have the Apache Commons Math library in your Java projects classpath and add the following import line in your source code:
import org.apache.commons.math3.random.MersenneTwister;