500
500

Reputation: 6619

Combination without repetition in Mathematica

How could I obtain 48 random pairs of two different elements drawn from Range[96] with no repetition ? That is the 96 elements are only used once.

While I tried Tuples/Subsets combined with Select, I feel there must be a more straightforward way to achieve this.

Upvotes: 4

Views: 1601

Answers (2)

Prashant Bhate
Prashant Bhate

Reputation: 11087

Partition[RandomSample[Range[96]],2]

Upvotes: 4

Mr.Wizard
Mr.Wizard

Reputation: 24336

Please tell me if this is correct:

Partition[RandomSample@Range@96, 2]

Upvotes: 8

Related Questions