# Pick random number based on the values of a distribution whose PDF is unknown

I've got a list of $$99$$ values

$$y_{0.01}, y_{0.02}, ..., y_{0.99}$$

which are drawn from a distribution ("$$y_{0.01}$$" is the y-value of the PDF for {x = 0.01}). I don't know the PDF that corresponds to these values; the values are all I've got.

I'm trying to pick a "random" number from the interval $$(0,1)$$, but subject to the given values. So, for instance, if $$y_{0.53}$$ is the maximal value in my list, then the probability of my random value being $$0.53$$ should be the highest compared to all other values in my list. I'm wondering how to best go about this.

I was thinking if I could somehow figure out the quantile function that corresponds to my list, i.e. the inverse of the CDF of the distribution, then I could simply pick a random number on $$(0,1)$$ and plug that number into this function. But I only have the values on my list...

• have you tried fitting this distribution to a normal or lognormal or ... parametric distribution? – phdmba7of12 Aug 9 '19 at 15:24
• The initial values are based on a beta distribution, but they're subject to change over time... – sdlkgjh45 Aug 9 '19 at 15:25

To clarify your question: you have 99 samples of PDF $$f_X(x)$$ at points $$x = 0.01, 0.02, ... 0.99$$. You want to pick a number from the distribution that has overall unknown PDF $$f_X(x)$$.

Solution:
The first step is to convert the PDF to a PMF of corresponding discrete distribution. Let the discrete RV is $$W$$. Let PMF of $$W$$ is $$P_W(w)$$.

Since, you have the PDF values at $$x = 0.5$$ (for example), $$P(0.495 < x < 0.505) = y_{0.50} \times (0.505 - 0.495)$$. For discrete case, it is equivalent to $$P_W(w = 0.5) = y_{0.5} \times 0.01$$.

With this PMF, you can calculate the CDF, make a table (or write a general function), and do a reverse lookup to get inverse CDF function. Then, as you mentioned, a uniform random variable between (0,1) should give you a number with given PMF $$P_W(w)$$.

Note that this method gives you the precision of 0.01. If you want more precision, you can interpolate the sequence $$y_i$$. One way is to fit a curve or create a step function that passes through $$(i, y_i)$$ and consider the new function as "finely" sampled PDF $$f_X(x)$$.

Cheers.