changed location of random creator

in the randomize function, random  r is now created and instantiated
outside of the for loop.