Created
April 2, 2020 15:00
-
-
Save johnmyleswhite/f85773742173bfb1ea6251d5c378ad3f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prob(n) | |
s = 0 | |
for _ in 1:n | |
x_i = rand(UInt) | |
s += Int(Float64(x_i) === Float64(x_i + 1)) | |
end | |
s, n | |
end | |
prob(1_000_000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment