Name: RandomSubset - random subset of an array without repetition

Synopsis:

rng array int RandomSubset -&gt; array


Examples:

rng [5 7 2 9 1 6 8] 3 RandomSubset --&gt; [2 7 5] 
rng [5 7 2 9 1 6 8] 3 RandomSubset --&gt;  [6 8 7] 
rng [5 7 2 ] 3 RandomSubset --&gt; [7 2 5] 
rng [5 7 2 ] 3 RandomSubset --&gt; [5 2 7]


Description:

rng a n RandomSubset returns an array of size 
n with elements randomly select from array a. 
Selection is made without repetitions. 
Therefore, 
a length n geq 
is required.


Parameters:

rng, random number generator


Bugs:

not yet protected by trie


References:

Skiena, Steven S. (1990) 
Implementing discrete Mathematics: combinatorics and 
graph theory with Mathematica. 
Addison-Wesley, Redwood City.


Author:

Diesmann


FirstVersion:

4.5.2001


SeeAlso:

drand
Part
Select

Source:

/var/www/debian/nest/nest-simulator-2.20.0/lib/sli/librandom.sli
