The random walk method is illustrated in the following pseudo-codes:
for (i=1 to n)
x0[i]=random(-SEARCHRANGE,SEARCHRANGE);
f0=f(x0);
for (counter=1 to MAXCOUNT) {
for (i=1 to n)
delta_x[i]=random(-STEPSIZE,STEPSIZE);
f1=f(x0+delta_x);
if (f1 < f0) {
x0 = x0 + delta;
f0 = f1;
}
}