Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # N times iteration. Initialize answer as 0.
- N = 1000000; ans1 = 0
- # Roll two dice, x and y.
- for i in 1:N
- # Define pip of die x.
- x = rand(1:6)
- # Define pip of die y.
- y = rand(1:6)
- # Obtain the minimum pip.
- z = min(x,y)
- # Add the minimum pip to answer.
- ans1 = ans1 + z
- end
- print(ans1/N)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement