Code:
import java.util.Random;
public class Probability_distribution_Function_Random_Numbers
{
static int N = 10;
public static void main(String args[])
{
Random random = new Random();
int p=0;
for(int i=0; i
{
p = random.nextInt(400);
if(p > 360)
System.out.println(1 + " ");
else if(p < 0)
System.out.println(0 + " ");
else
System.out.println(p*0.1/360 + " ");
}
}
}
Output:
The random numbers are:
0.08527777777777779
0.07361111111111111
0.007222222222222223
0.08694444444444445
1
1
0.05527777777777779
0.0952777777777778
0.04888888888888889
0.016944444444444446
More Java Programs: