Here you can find the source of randomChance(double chance)
Parameter | Description |
---|---|
chance | chance for a true result (between 0 and 1, automatically clamped) |
public static boolean randomChance(double chance)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from ww w. j a v a2 s . c o m*/ * generates a random output based on a chance * @param chance chance for a true result (between 0 and 1, automatically clamped) */ public static boolean randomChance(double chance) { return Math.random() < chance; } }