<p>I need to make a random list of permutations.  The elements can be anything but assume that they are the integers 0 through x-1.  I want to make y lists, each containing z elements.  The rules are that no list may contain the same element twice and that over all the lists, the number of times each elements is used is the same (or as close as possible).  For instance, if my elements are 0,1,2,3, y is 6, and z is 2, then one possible solution is:</p>

<pre>
0,3
1,2
3,0
2,1
0,1
2,3
</pre>

<p>Each row has only unique elements and no element has been used more than 3 times.  If y were 7, then 2 elements would be used 4 times, the rest 3.</p>

Ok, one way to approximate that:
1 - shuffle your list
2 - take the y first elements to form the next row
4 - repeat (2) as long as you have numbers in the list
5 - if you don't have enough numbers to finish the list, reshuffle the original list and take the missing elements, making sure you don't retake numbers.
6 - Start over at step (2) as long as you need rows
I think this should be as random as you can make it and will for sure follow your criteria. Plus, you have very little tests for duplicate elements.