Generate random values using an empirical cumulative distribution function [migrated]

The standard "graphical" answer is that you pick a random number between 0.0 and 1.1, and find that on your y axis. Move right until you hit your graph. Then move down to the x axis and that's the value.

If your graph really is just an empirical graph, then the second step is a binary search through a monotonically increasingly list. The index of that found value (or the closest value) then is mapped to an x value, which is the value you want to produce.