0

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 in C# 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. What I'm specifically worried about is that the algorithm might get stuck in a state where there are more duplicate elements than there are sets with room for those elements. 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.)

Doomberry
  • 11
  • 1
  • 1
    Please provide a [Minimal, Complete, and Verifiable Example](https://stackoverflow.com/help/mcve) of your question. We would like to help, but you need to attempt to code a solution first. – absoluteAquarian Aug 28 '18 at 16:13
  • It is not entirely clear what all the constraints are on your problem. For example, is it a requirement that every license that appears n times in the original multiset also appear exactly n times in the random lists? Or can it appear more times, or fewer? That is, is a constraint on your problem that the multiset of the *new* lists be *identical* to the multiset of the *original* lists? – Eric Lippert Aug 28 '18 at 18:56
  • Also, what are the constraints on the distributions? For example, is it a requirement that your randomizer produce widely different lengths of lists for each board, where some boards have three licenses and others have all 350? Or would it be acceptable for each board to have roughly 1/12th of the available 1626 licenses? – Eric Lippert Aug 28 '18 at 19:01
  • Finally, once we have the constraints on the combinatorics down, then we have the question of *randomness*. There will be some gazillions of possible combinations that meet your requirements. Consider a card game. It is a requirement of card games that *you be unable to deduce the likelihood of other player's hands simply by looking at your own hand and knowing something about the random number generator*. Do you have similar constraints here? – Eric Lippert Aug 28 '18 at 19:03
  • Or, again, considering a card game, it is a requirement that if you're dealing a hand of bridge that all 52 factorial possible orderings in real life be equally possible in the simulation. **Is it also a requirement of your system that all gazillion possible combinations be exactly equally likely**? These conditions are tricky to get right, and failure to do so can have serious consequences. – Eric Lippert Aug 28 '18 at 19:05
  • You say that each board has a different number of licenses. Is it a *requirement* that each board have a different number of licenses from every other board? Or is it acceptable for two to both have 123 licenses? – Eric Lippert Aug 28 '18 at 19:07
  • What I'm getting at with all these questions is: **the reason you are having difficulty with the problem is because it is very, very under-specified**. As you write a more and more detailed, careful, accurate specification, the algorithm will start to emerge from those constraints. – Eric Lippert Aug 28 '18 at 19:08

0 Answers0