I was doing some operations with arrays, like this (very simple)
a = [1, 2, 3, 4]
b = [1]
b.push((a-b).sample)
=> [1, 2]
Ok, let’s see some times its value
b
=> [1, 2]
b
=> [1, 3]
b
=> [1, 2]
b
=> [1, 4]
I don’t understand why b changes. I supposed that i took a random element from de difference between a and b, and append it to b, so… where am i wrong?
EDIT:
Today is a new day, and magically, the same code runs ok…. it’s a mistery
Thank’s all!
Is this what you expect to get?