Unanswered question

How to select two variables with the same random number?

Hello,

I have two variables ($ {townName} and $ {townId}), which contain all the extracted occurrences (name1, name2, ...) and whose number may vary.
I try to use two variables randomly ($ {townName_rand} and $ {townId_rand} which must correspond, to each towName corresponds a townId having the same index.
How can I randomly extract ($ {townName_rand} and $ {townId_rand} where rand is between 1 and ($ {townName_matchNr) and n must of course be the same for both variables.

Thank you.

Kind regards

Denis R.
Denis R.

Denis R.

Level
0
18 / 100
points

Answers

Neil W.
Neil W.

Neil W.

Level
4
5000 / 5000
points
Team

don't use _rand, as the name suggests, they will be random. Instead use _matchNr to get the item counts, use javascript to pick the one with the lowest number of matches (if one list has 5, the other 7, you use 5 as both have 1 - 5 elements). Use the supplied random number function to generate a number between 1-5. Assign this to a variable. then townName_{ranSel} and townID_${ranSel}