Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Need To Randomize Selections From A List But Ensure Uniqueness

$
0
0

I'm building a tool to randomize setup for a very large modular card game. There are several lists from which I need to select 2 to 6 non-duplicate entries, and each list is on a separate tab from the main randomizer.

I've been using this formula to get randomized selections:

=INDEX(Characters!A1:A, RANDBETWEEN(2,47))

This forumla is copied into 5 different cells to randomize 5 different selections. The list is long enough that duplicates don't happen often, but they do happen. I can't find a way to prevent duplicate selections.

If I was doing this in Perl I'd define the list items into an array and then randomly pop out array entries; unfortunately I need this portable across a wide range of devices, not all of which support Perl, which is why I'm using Google Sheets to begin with. I see that there's an array command in Google Sheets but I can't quite parse the syntax. Is the array command the way I want to go? If so, can anyone suggest good resources to grok that? Or is there another way to do it?


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>