MathGroup Archive 2001

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

Search the Archive

Re: Random Sampling Without Replacement?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26602] Re: [mg26586] Random Sampling Without Replacement?
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Thu, 11 Jan 2001 10:39:13 -0500 (EST)
  • References: <200101090652.BAA00242@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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?