The same problem still happens even if you have two instances of the same struct type. If you have two unordered collections, then you may get different sums every time you call. I said may because it is an implementation detail and it might work for some collections due to how maps/structs are implemented. But you shouldn’t trust it.
Maybe you should share more details of your problem. In general if you want an ordered operation, you need to use ordered data structures, such as lists.
I have a feeling that it could be solved with protocols. If you implement the Enumerable protocol to your struct, specifying how it is enumerable. I think it would be possible!
But I’m learning yet, so maybe you want to check it yourself. Just a tip