Package study.random

Source Code of study.random.TestRNGSpeed

package study.random;

import org.apache.commons.math3.random.RandomDataImpl;
import org.apache.commons.math3.random.RandomGenerator;
import org.apache.commons.math3.random.Well44497b;

import dclong.util.Timer;

public class TestRNGSpeed {
  public static void main(String[] args){
    //CommonMath
    RandomGenerator rg = new Well44497b(29);
    RandomDataImpl rng = new RandomDataImpl(rg);
    Timer timer = new Timer();
    timer.start();
    for(long i=0; i<130000000; ++i){
//      rng.nextPermutation(16, 8);
//      rng.nextGaussian(0, 1);
      rng.nextInt(0, 65779);
    }
    timer.stop();
    timer.printSeconds("generating random numbers");
  }
}
TOP

Related Classes of study.random.TestRNGSpeed

TOP
Copyright © 2018 www.massapi.com. 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.