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; ir)return i; } return a.length-1; } public static void main(String[] args) { int N=Integer.parseInt(args[0]); double[]t={.5,.3,.1,.1}; for(int i=0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!