I just wanted to know if clone did something different. I knew that temp = @data is just a copy. I don't know if their are added benifits to using clone. I have written several scripts and never saw a need to use .clone. Thank you for your help though. You did help me with the random numbers I didnt't think to set it up like that in the arrays elements, and you brought up a good point about the increments.
I'm sorry for ignoring the original question but just to answer this part.
Arrays and Hashes are "copied by reference" in Ruby by default. So:
a = [1,2,3]p a # [1,2,3]b = ab.shiftp a # [2,3]p b # [2,3]BUT
a = [1,2,3]p a # [1,2,3]b = a.cloneb.shift # remove first elementp a # [1,2,3] # <<<< now a is untouched!p b # [2,3]In languages like C++ this would be easier to see. In Ruby they somewhat 'suppress' the need to use pointers and whatever but in fact you are still using a lot of "pass by reference" (or 'pointers').
Why you need clone? Because you might want to perform a difficult search operation or bitmap operation or whatever on "a". Your algorithm might remove elements from "a" to find the last remaining element or use all sorts of bitmap functions on it. But you really don't want to alter "a" itself. In such cases you would need clone. Remember that "a" could also be an image or some sort.
Clone however does not clone anything that your variable itself may reference (aka just a shallow copy).