I think you can use Groovy's multiple assignment (http://groovy.codehaus.org/Multiple+Assignment) to avoid all the temp variables. Also, do things like vector1.i actually work? (Maybe they do, but it looks like magic to me.) Lastly, I again agree with an earlier comment by Kris that you don't want to def i and j outside of the loop like this. You want the def to be as local as possible, so one would typically prefer
```
for (def i = vectLength...) {
   def j = ran...
...
```