this question is from a interview a friend had and I was curious how to solve it.
The question is:
I have two random variables, $a$ and $b$.
$a=rand(1,100)$
$b=rand(a,100)$
The rand function generates a number within the range of the numbers in the parentheses, with equal probability for each number.
How is $b$ distributed (what is its probability distribution function), and if I want b to be uniformly distributed between $a$ and $100$, just as a is uniformly distributed between 1 and $100$, what should I do?
My aspiration is for them to be uniformly distributed; it's enough to make $b$ distributed more uniformly than it is now (I'm allowed to use any operator/function, etc.)?
My attempt:
My approach to solving this involves trying to use a new function, $c=rand(1,a)$, so that they might complement each other. I attempted to use modulo operations and an if statement, meaning if the number is not within the range, then generate a new number.
Had a few other attempts, reached:
$a$ distribute uniformly and $b$ not distribute as something "known", using the total of expectation value, but it is not clear.
Will be happy to receive help, thanks.

Interviewer:
Assume $a\sim U[0,1]\,,$ and conditional on $a\,,$ $$b\sim U[a,1]\,.$$ What is the unconditional distribution of $b\,?$
Candidate (sweating):
\begin{align} &\mathbb P\big\{b\le y\big\}=\int_0^1\mathbb P\big\{b\le y\,\big|\,a=x\big\}\,dx =\int_0^1\frac{y-x}{1-x}1_{\{x\le y\}}\,dx=\int_0^y\frac{y-x}{1-x}\,dx\\[2mm] &=-y\ln(1-x)\Big|_{x=0}^{x=y}+\Big[x+\ln(1-x)\Big]_{x=0}^{x=y}\\[2mm] &=-y\ln(1-y)+y+\ln(1-y)\\[2mm] &=y+(1-y)\ln(1-y)\,. \end{align} This is the unconditional CDF of $b\,.$
The PDF of $b$ is $$ \frac{d}{dy}P\big\{b\le y\big\}=2-\ln(1-y)\,. $$ The plot of it resembles the one in Joseph's answer.
To work out a possibility to turn this $b$ into a random variable that is unconditionally uniform on $[c,1]$ where $c$ is fixed (I deliberately don't denote this by $a$) one can use the well-known method to
stick $b$ into its own CDF by which it produces a $U[0,1]$ variable and then
stick that into the inverse CDF of the desired distribution.
The CDF of $U[c,1]$ is $$ x\mapsto \frac{x-c}{1-c} $$ which has inverse $$ y\mapsto (1-c)y+c\,. $$ Therefore, $$ (1-c)\Big\{b+(1-b)\ln(1-b)\Big\}+c $$ is uniform on $[c,1]\,.$