Javaで必要な確率で配列文字列のリストからランダム文字列を生成しようとしています.ランダム文字列を生成できますが、確率をどうするかわかりません.プログラムをほぼ25〜30回実行する必要があります
Probability for abc is 10%
for def is 60%
for ghi is 20%
for danny is 10%
しかし、私はこれを行うことができません。
import java.util.*;
public class newyork
{
public static void main(String[]args) throws Exception
{
// othr fun
public static void abc()
{
//Strings to display
String [] random = {"abc","def", "ghi","danny"};
//Pick one by one
String no1= random[(int) (Math.random()*(random.length))];
String no2 = random[(int) (Math.random()*(random.length))];
String no3 = random[(int) (Math.random()*(random.length))];
//print randomly generated strings
System.out.println("Here you go : " + no1 + " " + no2 + " " + no3 + ");
}