vendredi 24 avril 2020

Combine arrays and shuffling two arrays in order [closed]

The title is a little tricky, but this is what I want to mean: I have 2 arrays

A = [1, 2, 3, 4, 5]
B = ['a', 'b', 'c', 'd', 'e']

I want to merge and shuffle them but keeping their orders, something like this:

C = [1, 2, 'a', 3, 'b', 'c', 4, 'd', 'e', 5]

As you can see, they are randomly merged, but they kept their individual order. How could I do that?

Note that the merge does not have to be in any certain distribution while it is ordered as I asked.




Aucun commentaire:

Enregistrer un commentaire