Shuffling an array


I have looked at the following Task but did not succeed in shuffling an array.

I have the following bundles (with questions) and in the bundle arrays (with answers)

I would like to shuffle both the questions and the answers.

After the array aggregator I have a webhoock response. I think I need to introduce one (or 2) modules in between to do the shuffling. Do I have to convert the bundles into an array? And if yes how ?

Thanks for your help

If I understand correctly, your Parse JSON module gives you the array of collections shown in your text window. Each element in that array is a collection consisting of “text” (the question) and “answers” (an array of multiple choice answers).

You’re not just trying to pick array element at random - that might result in the same element being picked again. You need to produce an entirely new array that has been shuffled. You need to shuffle both the top level array, and within each of those top levels, you need to shuffle the answers.

Make includes a handy “shuffle” function in the array functions. Shuffle() returns a new, shuffled array.

So I would use the Iterator to turn your top-level array into bundles. For each of these bundles you would then construct a new data structure of the “text” and a shuffled array for the answers. You’d then use the Aggregator to turn all those back into a top-level array, and then you’d shuffle that.

The downside is that this could use a lot of operations. If you had say 3 operations, you’ll use 3 x Q x A operations (where Q = number of questions and A = number of answers).

If this is likely to be high volume, you’d be better off doing the array shuffling externally - for example as a Google Cloud Function (see an example here: Using JavaScript with Integromat | by John Thomson | Medium) or as an Amazon Lambda function (see

1 Like

thanks - good point with the operationscost - i will have a look at the external solution first

could I add a Key “order” to the array and assigne it a random number (5 digits or even 10) and then Order the array by the key order? or does this also costs a lot?

The sort() function could help (see

But you’ll still need to insert that key into the answers arrays and the top-level items, which means iterating (which means operations).

You’ll also still need to iterate through the top-level items and reconstruct them with a sorted “answers” array.

So I’m not sure it helps.

1 Like

Thanks - Maybe I can use the UUID - convert to int with md5 and a Variable called salt


Salt is created randomly (or send per url) - this would also have the advantage if i send the same SALT I have the SAME result in the order .

What do you think? Will that work in one Sort command?