Page 1 of 1

What is the probability for z to be equal to 3 after running the following code? x = Math.random(); if (x<0.2) z = 0;

Posted: Wed Mar 30, 2022 9:17 am
by answerhappygod
What is the probability for z to be equal to 3 after running the
following code?
x = Math.random();
if (x<0.2)
z = 0;
else if (x>=0.4 && x<0.6)
z = 1;
else if (x>=0.8)
z = 2;
else
z = 3;