## How to arrange k items in N ways with equal probability

number of ways to arrange n objects in m places

number of ways to arrange n objects with repetition

permutation

combination formula

permutation formula

permutations and combinations

permutation calculator

I have 7 items, k1-k7 and I want to arrange them in 30 different ways with each item appearing in each position with equal probability.

k1, k2, k3, k4, k5, k6, k7 k1, k4, k5, k3, k7, k6, k2 . k6, k2, k7, k1, k5, k4, k3

I am not able to understand which is the method to achieve this. Please let me know which algorithm will work here.

If I understand you correctly, then these thoughts should work for you:

There are `7! = 5040`

possible ways to arrange your elements.
Out of these `5040`

unique sequences there are `6! = 720`

of them that have `k1`

at the first position, `720`

have `k2`

at the first position, ..., `720`

have `k1`

at the last position, ... and so on.
So, if you randomly draw `30`

from these `5040`

sequences, I think the result should meet your requirements.

How to draw them? Well, that depends on the programming language you are using. In C++ there is `next_permutation`

. In python there is `itertools.permutations`

. These functions will iterate through all `7!`

possible arrangements in a lexicographical order. Other languages may offer similar tools.

Then, you can randomly generate a number `n`

in `[0, ..., 5040[`

and call `next_permutation`

`n`

times on the initial range (or, in python, advance the iterator `n`

times). Repeat this 30 times.
Note however, that for bigger number this can quickly become very inefficient, not sure what your needs are regarding efficiency.

##### Update

The more I think about my solution, the more i realize that *How to draw them?* can be answered much better:

All you need is a uniform shuffle algorithm. This will by definition uniformly generate one of the `7!`

permutations which is exactly what my original answer does, but it will be much more efficient and much simpler to code as most languages provide such a shuffle algorithm (e.g. C++).

I will keep my original answer because it helps me (and hopefully others) to understand why a uniform shuffle is the correct solution here.

**Number of ways to arrange K different objects taking N objects at a ,** As N is always less than or equal to K, an answer greater than 0 shall So, the total number of ways to select N objects from K objects is KCN� How many different ways I can keep N balls into K boxes, where each box should atleast contain 1 ball, N >> K, and the total number of balls in the boxes should be N?For example: for the case of 4 balls and 2 boxes, there are three different combinations: (1,3), (3,1), and (2,2).

My first attempt would be take one random element out of the list, next take a random element form the subset of not chosen elements and so on. For the second subset do the same and when done, check if its equal the first subset. Due to uniform distribution of good random function it should give you equal probabilities

**Permutations,** If you have a collection of n distinguishable objects, then the number of ways you can As in all of basic probability, the relationships come from counting the number of ways specific 5x4x3x2x1 = 120 ways to arrange five objects. For the purposes of card playing, the following ways of drawing 3 cards are equivalent:� The number of total possible ways of choosing the first two items is therefore n * (n-1) because for each of the n first items we could choose we have n-1 second items possible. Now, for the 3rd item selected there are n-2 items left in the list (since we’ve already used up 2 items out of a total of n), which means that in choosing three

You cannot, at least not as stated in the description. If `k_1`

was to have the same probability of appearing at each position, then the number of combinations where it appeared at position 1 would equal the number of combinations where it appeared at each of the other positions. But that means that the number of combinations would have to be a multiple of 7, which 30 is not.

If you only care about the probability when you draw the 30 combinations, then randomly choosing the sequence is the way to go, as Brueni suggests. However this has nothing to do with there being 30 combinations, so I doubt this is what you intend?

**Combination formula (video) | Combinations,** Next lesson. Probability using combinatorics. Sort by: Top Voted For n people sitting on k Duration: 11:17
Posted: Aug 29, 2015 The formula for combinations: To find all of the differennt ways to arrange r items out of n items. Use the combination formula below. (n stands for the total number of items; r stands for how many things you are choosing.)

**Combinations and Permutations,** r!(n - r)!. We have 3 distinct objects so n = 3. And we want to arrange them in groups that these events can be performed together is equal to n1n2 . . . nk ways. When statisticians refer to permutations, they use a specific terminology. They describe permutations as n distinct objects taken r at a time. Translation: n refers to the number of objects from which the permutation is formed; and r refers to the number of objects used to form the permutation. Consider the example from the previous paragraph.

**[PDF] 4 Combinatorics and Probability,** of ways to pick k things out of n and arrange the k things in order. Counting the number of ways objects, some of which may be identical, can be distributed� A permutation of a set of objects is an ordering of those objects. When some of those objects are identical, the situation is transformed into a problem about permutations with repetition. Problems of this form are quite common in practice; for instance, it may be desirable to find orderings of boys and girls, students of different grades, or cars of certain colors, without a need to

**Partitions of n elements into k groups,** $g_{2}$ , , $g_{k}$ is one of the possible ways to assign the n objects to the k groups. of the n objects is equal to the number of combinations of $n_{1}$� Program to find the profit or loss when CP of N items is equal to SP of M items; Probability of distributing M items among X bags such that first bag contains N items; Count number of ways to get Odd Sum; Count of different ways to express N as the sum of 1, 3 and 4; Count ways to express 'n' as sum of odd integers; Count ways to reach the n'th

##### Comments

- Thanks, this is what I was looking for :-)
- @RudreshaParameshappa glad to hear that :) please read my update
- There are two different ways to look at this: If you have 10 numbers and you
*don't know*their values, you just know that they were "created" by rolling a dice, then you still do know that each number from 1 to 6 has equal probability (`1/6`

) of appearing at each position (even though 10 is not a multiple of 6), because you know for each position the dice has been rolled. This changes however, if you additionally*know*that the dice rolled 3 ones. Then, the probability of having a one at a certain position is of course`3/10`

.