public static int getBinomial(int n, double p) { Random random = new Random(System.currentTimeMillis()); int f = 0; for(int i = 0; i < n; i++) { if(/*Math.random()*/random.nextDouble() < p) { f++; } } return f; }