Skip to main content
1 of 3
Alex A.
  • 24.7k
  • 5
  • 38
  • 119

Julia, 17 bytes

f(n)=n==rand(1:n)

This is a function that generates a random integer between 1 and n and tests for equality with n. There will be a 1/n chance of returning true.

Alex A.
  • 24.7k
  • 5
  • 38
  • 119