Command: RandomSubset

NEST HelpDesk Command Index NEST Quick Reference

Name:
 RandomSubset - random subset of an array without repetitions 
Synopsis:
 rng array int RandomSubset -> array 
                   
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    
Examples:
 
    rng [5 7 2 9 1 6 8] 3 RandomSubset --> [2 7 5] 
    rng [5 7 2 9 1 6 8] 3 RandomSubset -->  [6 8 7]   
    rng [5 7 2 ] 3 RandomSubset --> [7 2 5]  
    rng [5 7 2 ] 3 RandomSubset --> [5 2 7]  

Bugs:
 
   not yet protected by trie
Author:
 Diesmann
FirstVersion:
 4.5.2001
References:
  
    Skiena, Steven S. (1990)
    Implementing discrete Mathematics: combinatorics and
    graph theory with Mathematica. 
    Addison-Wesley, Redwood City.
SeeAlso:drand Part Select
Source:
 /home/abuild/rpmbuild/BUILD/nest-2.4.1/lib/sli/librandom.sli

NEST HelpDesk Command Index NEST Quick Reference

© 2000-2010 The NEST Initiative