MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Random Sampling Without Replacement?


Use Add-On package DiscreteMath`Combinatorica`:

In[1]:=
<< DiscreteMath`Combinatorica`
In[2]:=
univ = Range[15];

One random sample of size 3 without replacement:

In[3]:=
RandomKSubset[univ, 3]
Out[3]=
{1, 5, 13}

5 random samples of size 3 without replacement:

In[4]:=
Table[RandomKSubset[univ, 3], {5}]
Out[4]=
{{1, 5, 9}, {3, 4, 14}, {4, 6, 12}, {2, 6, 9}, {1, 6, 7}}

Tomas Garza
Mexico City

----- Original Message ----- 
From: "A. E. Siegman" <siegman at stanford.edu>
To: mathgroup at smc.vnet.net
Subject: [mg26602] [mg26586] Random Sampling Without Replacement?


> Looking for neat compact way to extract three distinct (i.e., nonequal) 
> randomly selected integers k1, k2, k3 from the range 1 to N (N > 3) -- 
> in other words, random sampling without replacement -- ???
> 



  • Prev by Date: Re: Random Sampling Without Replacement
  • Next by Date: Re: Sum of Squares
  • Previous by thread: Re: Random Sampling Without Replacement?
  • Next by thread: Re: Random Sampling Without Replacement?