Try it online! (contains a footer that runs the program 100 times and reports the results)
I had to triple-check to make sure that Jelly wasn't here yet; it's a popular language, after all. But it turns out it wasn't.
X picks a random element from a list. Because it's at the start of the program but requires an input, it'll implicitly take the first command line argument as input. Most commands, when they expect a number but are given a list, convert the number into a range from 1 to that number; thus, for example, an input of 4 will pick a random element from [1, 2, 3, 4]. (Actually, Jelly has a special case to optimise this internally by not constructing the list.) Note that for an input of n, this means that there's a 1 in n chance of picking 1 as our element.
Once we have our element, we run
Ị on it. That's a test for a small value, i.e. no higher than 1 or smaller than -1. The only element that we can produce that matches this condition is 1, so we get an output of true (expressed as
1 in Jelly) with 1/n probability, and false (expressed as
0 in Jelly) the rest of the time. The output then gets printed implicitly.
(This submission also works as a function rather than a full program, exactly the same way; the implicit input is then taken from the function argument, and the implicit output used as the function's return value.)