function f = randoptcanny(start,trials)

%%% Do trials trials of random masks to see what comes out
%%% There are much better ways to do this ...

len = length(start);

f = start;
f = f - mean(f);
f = f/norm(f);

v = cannysimple(f);
fnew = f;

for I=1:trials
    loc = min(floor(rand*len)+1,len);
    fnew(loc) = f(loc) + .05*rand;
    fnew = fnew-mean(fnew);
    fnew = fnew/norm(fnew);
    vnew = cannysimple(fnew);
    if (vnew > v)
       v = vnew
       f = fnew
    end
end
