mardi 28 août 2018

How do I randomly split a multiset into sets of predetermined sizes, without duplicates?

I'm looking for help on a problem which I don't know how to deal with. I'm guessing similar questions have already been asked, but I couldn't google it the right way.

What I'm trying to do is a randomizer for the boards in FFXII and there's a part of the problem I don't know how to solve: the randomization.

I'm simplifying a bit here: there are 12 boards containing licenses that you can unlock to equip stuff or use magic. Board spots may be empty and no single license may appear twice on one board, but licenses can occur several times if they are on different boards. Each board also has a different number of licenses. There's a total of 1626 licenses on the boards, with the number of unique licenses being around 350. I have a list of all licenses, along with the number times they occur in the original board setup. (The one you get if you play the game normally.)

I would like help with generating 12 random licence lists of predetermined size, without duplicates, from the multiset of licence occurences in the original game. The total size of the 12 lists is equal to the number of elements in the multiset, of course. (I'll place them on the board myself, that is not too difficult.)

Oh also, I'm coding in C#, but this is more of a combinatorics question, so the exact language is not as important.




Aucun commentaire:

Enregistrer un commentaire