Here is an image of what I managed to get. Looks good to me.
What is even better the solution is very uncomplicated .
float y_low, y_high;
float[] y;
void setup() {
size(640, 400);
background(255);
y = new float[width];
y_low = 0;
y_high = height / 2;
// Draw th graph
stroke(64);
for (int i = 0; i < y.length; i++) {
y[i] = randomLinear(y_low, y_high);
line(i, height / 2 - y[i], i, height / 2);
}
// Draw the sorted graph
y = sort(y);
stroke(255, 10, 100);
for (int i = 0; i < y.length; i++) {
line(i, height - y[i], i, height);
}
}
/**
Return a random value >= low and < high such
that the distribution is proportional to the
returned value.
*/
float randomLinear(float low, float high) {
float r = sqrt(2) * random(1/sqrt(2));
return r * (high - low) + low;
}