Question
Fill blanks of the following code segment that simulate rolling two six-sided dice and getting the sum using discrete() method of StdRandom class on page
Fill blanks of the following code segment that simulate rolling two six-sided dice and getting the sum using discrete() method of StdRandom class on page 226 of the textbook. [5 points]
This is a java program
int sum, eye1, eye2;
____________ p = _________________;
for (int i=0; i<6; i++) _____________________
eye1 = ________________________;
eye2 = ________________________;
sum = eye1 + eye2
this is StdRandom program from p.226
the question comes from Introduction to Programming in Java
This is the book website: http://introcs.cs.princeton.edu/java/home/
this is StdRandom program from p.226 public class StdRandom { public static int uniform(int N) {return (int)(Math.random()*N);} public static double uniform(double lo, double hi) {return lo +Math.random()*(hi-lo);} public static boolean bernoulli(double p) {return Math.random()
= 1 || r == 0); return x * Math.sqrt(-2 * Math.log(r) / r); } public static double gaussian(double m, double s) {return m+s*gaussian();} public static int discrete(double[] a){ double r =uniform(0.0,1.0); double sum=0.0; for(int i=0; i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started