n = length(x);f = 0:1/(n-1):1;pd = makedist('PiecewiseLinear', 'x', x, 'Fx', f);
xr = random(pd, 1000, 1);