biased coin
biased dice
biased list
Method: public static boolean flip(double p)
Instruction: you input a value which is smaller 1 and bigger than 1. The value will be the chance of true.
Example: p = 0.9. The chance of getting true is 0.9 while the chance of getting false is 0.1
Method: public static int roll(double p1, double p2, double p3, double p4, double p5, double p6)
Instruction: you input 6 values which sum of them are 1.0
Example: p1 = 0.1; p2 = 0.1; p3 = 0.1; p4 = 0.1; p5 = 0.1; p6 = 0.5. The chance of getting 6 is 0.5 etc.
Method: public static int pick(double[] p)
Instruction: you pass an array of real values which sum of them are 1.0
Example: double[] p = {0.1, 0.2, 0.3, 0.4}; The chance of getting 3rd element is 0.4 etc.
Please run and try out codes to understand more.
All methods use all basic programming concepts, which mean that it's easy to implement on other languages.