Randomly selecting 2 words without replacement

11 views
Skip to first unread message

Ayse Selin Toprakkiran

unread,
Sep 11, 2022, 5:13:32 PM9/11/22
to Minno.js
Hi everyone,

I am trying to create 2 global variables out of a list of 35 words (without replacement). In the current code, I can successfully choose 1 word from this list and create a global variable, using:

 var ethnicity = API.shuffle([...])[0];
 API.addGlobal({
            ethnicity : ethnicity});

Do you know how I could instead select two words to create two global variables? To clarify, we are trying to assign each participant to 2 groups out of 35 to ask them to rate their perceptions of these groups, so it's crucial that there's no replacement.

Any help would be very appreciated!

Selin

Mayan Navon

unread,
Sep 12, 2022, 3:09:45 AM9/12/22
to Ayse Selin Toprakkiran, Minno.js
Hi Ayse,

To assign a condition you need a single value, rather than an array of 2. So I would just create two global variables, one for each condition e.g.,  var ethnicity1 = API.shuffle([...])[0];  var ethnicity2 = API.shuffle([...])[1];

Mayan


--
You received this message because you are subscribed to the Google Groups "Minno.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minnojs+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/minnojs/ce169010-f850-4c89-880d-c38804c2a5ffn%40googlegroups.com.

Mayan Navon

unread,
Sep 12, 2022, 3:16:15 AM9/12/22
to Ayse Selin Toprakkiran, Minno.js
Sorry,
I meant:  var ethnicity_arr = API.shuffle([...]);  var ethnicity1 =  ethnicity_arr[0];  var ethnicity2 =  ethnicity_arr[1];
Mayan

Ayse Selin Toprakkiran

unread,
Sep 12, 2022, 3:11:40 PM9/12/22
to Minno.js
That worked, thank you so much!

Best,
Selin

Reply all
Reply to author
Forward
0 new messages