I have a data set of with a distribution that looks something like this:I need to take random sample data from the set so that distribution will be more even. Something like this (take the data in the green area):I know how to do this by taking the data, putting into separate buckets  (distribute the data into X buckets, taking up to Y samples from each bucket), but I was wondering if there is there an easier way.P.S. the result doesn't have to be 100% accurate - a good approximation is enough.
How to sample a statistically uniform dataset
dataset