Python - a function to generate numbers with the same distribution as a data set

Viewed 46

I have a set of data - let's assume a series of float numbers. Therefore not a continuous set of integers (possibly an important point). That data has its own distribution (which is not guaussian or normal, or - as far as I can tell - any of the other standard ones).

If I plot that distribution (as a histogram + KDE + rug plot), that data looks like this: enter image description here

In Python, I would like to create a function that would take as input that set of data, and output a generator. That generator, when called, would generate new "random" data in the same range (min/max) of values, such that its outputs would have as close as possible a "distribution" compared to the original set.

Therefore, if I was to those new values, the graph would look roughly the same.

Is there any simple way to do so with standard or open-source Python modules?

1 Answers
Related