Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum > General > > "Subsets"

Post Reply:
Name:
Email Address:

Please send email when my message is replied to.

Url (optional):
Subject:
Message: view original message?
Attachment (optional):
Please answer this:2+4 =



Original Message (ID '426032') By jf:
RandomSample is exactly what you want. Since your keyboard is too old to have lower-case letters, you might have an old Mathematica, too. In 5.2, In[7]:=x=20; lst = Range[x,1,-1] Out[8]= {20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1} To take 3-element subsets: In[9]:= Table[ lst[[ Random[Integer,{1,x}]]],{3}] Out[9]= {15,1,19} You could do something with Union and Take to eliminate duplicates.