z11.M_ath Maven / Gradle / Ivy
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package z11;
import java.util.Random;
/**
*
* @author vietduc
*/
public class M_ath {
private static Random rn = null;
public static boolean hit(double d) {
return Math.random() < d;
}
public static int getrd(int arg) {
return (int) (Math.random() * arg);
}
public static int getrd() {
return getrd(1000000);
}
public static int getrd10() {
return getrd() % 10;
}
public static String getrd10s() {
return String.valueOf(getrd10());
}
public static double genNextGaussian(double mean, double standard_deviation) {
if (rn == null) {
rn = new Random();
}
return rn.nextGaussian() * standard_deviation + mean;
}
public static void main(String[] args) {
for (int i = 0; i < 100; i++) {
z11.L_ogger.print("" + M_ath.genNextGaussian(100, 1));
}
}
}