Why is it possible to generate a random real from the uniform distribution, but not a random rational or algebraic number from a distribution with similar properties?

  • $\begingroup$ Do you understand why we can't uniformly sample $\Bbb Z$? Can you see why the same logic applies to $\Bbb Q$, or $\Bbb Q\cap[0,\,1)$ for that matter? $\endgroup$
    – J.G.
    Commented Jul 10 at 9:05
  • 3
    $\begingroup$ There is no uniform distribution on a countably infinite set since for mutually exclusive events you have $P\left(\bigcup\limits_{i = 1}^\infty E_i\right) = \sum\limits_{i=1}^\infty P(E_i)$: if all the $P(E_i)$ were equal, you would either get a total probability of $0$ or get $\infty$ when it should be $1$. $\endgroup$
    – Henry
    Commented Jul 10 at 9:07
  • $\begingroup$ I do understand, but my question is about the reals. Why is it possible in the reals? $\endgroup$
    – Abijah
    Commented Jul 10 at 9:23
  • $\begingroup$ It's not unless you're referring to Bayesian improper priors. If you're not, then you have to specify a finite range for your distribution. $\endgroup$ Commented Jul 10 at 11:00

1 Answer 1


Let's assume $A$ is some subset of the real interval $[0,1]$. We have 3 cases:

  1. $A$ is finite, $|A| =n$. Then we can have a uniform probability for any $x\in A$: $P(x)=1/n$. In this way, $P(X \in A) = \sum_{x\in A} P(x) = 1$ and we are fine.

  2. $A$ is countably infinite. Then either $P(x)=0$ or $P(x)=\epsilon >0$. But in the first case $P(X \in A) = \sum_{x\in A} P(x) = 0$ (no good) and in the second case $\sum_{x\in A} P(x) = \infty$ . So in neither case we can build a uniform probability.

  3. $A$ is infinite not countable. In this case we might have $P(x)=0$ but still $P(X \in A)=1$ because the total event cannot be descomposed as a countable union, which would result in countable sum of zero probabilities. This is the case of the $A=[0,1]$ using the standard measure.

So, the rationals are "too many" (to be assigned a positive probability) and "too few" (to be assigned a zero probability).

More in detail: see Countable vs. Uncountable Probability or Probability measure on the Rationals. density function, and integration? or Uniform measure on the rationals between 0 and 1

See also https://math.stackexchange.com/a/4945371/312 ("there's no such thing as choosing a random element of a countably infinite set uniformly at random")


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .