Choose independently two numbers B and C at random from the interval [0, 1] with uniform density. Prove that B and C are proper probability distributions. Note that the point (B,C) is then chosen at random in the unit square. Find the probability that
# Function to pick a random number from the interval [0,1] 100 times.
# runif(n) generates n uniform random numbers between 0 and 1.
B <- runif(100, min=0, max=1)
C <- runif(100, min=0, max=1)
x <- B + C
sum((x)<0.5)/100
## [1] 0.14
x <- B * C
sum((x)<0.5)/100
## [1] 0.8
x <- abs(B - C)
sum((x)<0.5)/100
## [1] 0.76
x<- pmax(B, C)
sum((x)<0.5)/100
## [1] 0.22
x<- pmin(B, C)
sum((x)<0.5)/100
## [1] 0.69