I’m trying to create a sorted array but im having trouble understanding how I would created it.
I have a string (s1) and another array (a1,a2,a3,….).
I want to create a new array using the string and array. I would like to put them in this order (s1 – ar – s1 – ar – s1 -ar).
*ar = the original array in a random order.
How would I go about that creating this array?
Thanks for any help
*Edit: I would like a shuffled array having s1 string at every alternate index
I ended up shuffling the array and adding the string to every even index.
This is how I shuffled the array
This I what the output looked like
Array (s1,
a3,
s1,
a5,
s1,
a4,
s1,
a2,
s1,
a1)
Sorry If the question was poorly worded.