%mathpiper,def="RandomPickVector"

//Retract("RandomPickVector", *);

RandomPickVector(list, count) :=
[
    Check(IsList(list), "Argument", "Argument 1 must be a list.");
    
    Check(IsInteger(count), "Argument", "Argument 2 must be an integer.");
    
    Table(RandomPick(list),x,1,count,1);
];

%/mathpiper

    %output,preserve="false"
      Result: True
.   %/output







%mathpiper_docs,name="RandomPickVector",categories="User Functions;Statistics & Probability",access="experimental"
*CMD RandomPickVector --- returns a given number of randomly picked elements from a given list
*STD
*CALL
	RandomPickVector(list,count)

*PARMS

{list} -- a list which contains elements

{count} -- an integer which indicates how many elements to return

*DESC
Randomly picks {count} elements from the given list.

*E.G.
In> RandomPickVector({ONE,TWO,THREE},7);
Result: {THREE,ONE,THREE,THREE,ONE,TWO,TWO}

*SEE RandomPick, RandomPickWeighted
%/mathpiper_docs

    %output,preserve="false"
      
.   %/output








%mathpiper,scope="nobuild",subtype="manual_test"

RandomPickVector({ONE,TWO,THREE},7);

%/mathpiper

    %output,preserve="false"
      Result: {TWO,THREE,ONE,THREE,THREE,TWO,THREE}
.   %/output


