So the idea is take the _Typelist array and shuffle it and then find the indexes that correspond to each the symbols of the original _Typelist array. Is the last line the right way to write it?
Don’t mean to be rude but I’m honestly wondering if this is two AI bots talking on a forum? The OP question is not even syntactically correct Ruby. Just trying to run it with Ruby will give an error.
@cloa513 in that case I apologies! The proliferation of bots has got me on edge a bit too much.
To make it up, let me give you a one liner which I think improves on the bots answer:
_Typelist.each.with_index.to_a.shuffle
This will essentially convert each entry into into an array with two elements: the value and its index. So after you shuffle you’ll have them in random order but you’ll also have all the original indexes next to the values.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.