fixed Hopfield

the problem was annoyingly simple:

(int) Math.random()*num    returns 0, regardless of num's value