iterate array correctly so that random number is actually used in signing