[Math] Random irrational number generator

algorithmsirrational-numbersrandomtranscendental-numbers

Is it possible to create a algorithm that will generate irrational numbers $0<x<1$ with a density that is uniform down a specified resolution?

Would such an algorithm be necessarily limited to irrational, non-transcendental numbers?

If we wanted to make it possible to generate transcendental numbers, how would our algorithm express them, and would they "outnumber" the non-transcendental numbers so much that all outputs would be almost surely transcendental?

How would we prove that the distribution was uniform down to our specified resolution?

Best Answer

Let $n$ be the integer number of choices you want (the "resolution"). Let $Z$ be a random integer in the set $\{1, 2, ..., n\}$, equally likely over all options. Define $X = \pi Z/(4n)$. Then $X$ is the random irrational number you want.


I guess if you wanted it to have a density function, rather than a probability mass function, you could define $U$ as the standard uniform random variable over $(0,1)$ and define: $$ X = \left\{\begin{array}{ll} U & \mbox{ if $U$ is irrational} \\ \pi/4 & \mbox{ if $U$ is rational} \end{array}\right. $$ Then $U$ and $X$ have the same CDF and the same density.