Randomization excluding elements from a list question

Dear support team,

I am trying to do a second random selection of items from a list question. The condition of my randomization is to select one item that was not random selected before. I am attempting the following in order to avoid the second random rowcode to be the same as the first one:

Mylist.Where(x=>x. Item1!=RandomCode).Select(z=>z.@rowcode).ToArray()[rnd2.Value]

Where:

rnd2 is a random number generated by (long)Math.Floor(Quest.IRnd()*numHH.Value)
RandomCode is the rowcode of the first element selected randomly.

I am not sure if the .Where and .Select work for a list as they do for a roster. I think my error is coming from there. Any ideas would be appreciated

Dear Andres,

see the example “'Random selection of 2 persons in HH” in the public questionnaire “Public example User questions and common patterns”.

Best, Sergiy Radyakin