Extending Random Number Ranges

55 Views Asked by At

I am provided with a random number $\xi \in [0,1]$. I check if a particular $\xi_i \lt x$ is true and if so, I need to convert those random numbers within the range $[0,x)$ into uniform range in $[0,1]$. For example, if $x=0.5$, then I can check if $\xi \lt 0.5$ and if so, the new random number would be $y_i = \xi_i * 2.0$. If $\xi > 0.5$, then $y_i = \xi_i * 2.0 - 1.0$. I am not sure how to do it for other arbitrary ranges. Can someone shed light on this?

1

There are 1 best solutions below

0
On

I solved this trivially. We can extend both ranges by employing $y_i = \xi_i / x$ in case of the range from $[0,x]$ and $y_i = \frac{\xi_i - x}{1 - x}$.