SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 2 Vol 1

RANDOM K-SET OF N-SET

Name:
    RANDOM K-SET OF N-SET (LET)
Type:
    Let Subcommand
Purpose:
    Generate a random k-set of a an n-set.
Description:
    Given a set of n elements {1, 2, ..., n}, a basic combinatorial problem is the combination of n things taken k at a time. For a given n and k, there are

      (n k)  = n!/[k!*(n-k)!]

    k-sets of the original n-set.

    This command generates a single random k-set.

    The output is an array of size k that identifies the elements included in the k-set.

Syntax:
    LET <y> = RANDOM K-SET OF N-SET             FOR I = 1 1 <k>
    where <k> is a number or parameter that specifies the size of the k-set;
    and     <y> is a variable where the random k-set is saved.

    This command must be preceeded with the command

      LET N = <value>
Examples:
    LET N = 5
    LET K = 3
    LET Y = RANDOM K-SET OF N-SET FOR I = 1 1 K
Note:
    Dataplot implements this command using the RANKSB algorithm described in Nijenhuis and Wilf (see Reference section below).
Note:
    Dataplot supports a number of different random number generators. Enter HELP RANDOM NUMBER GENERATOR for details.

    The SEED command can be used to specify a seed for the random number generator.

Default:
    None
Synonyms:
    None
Related Commands: Reference:
    Nijenhuis and Wilf (1978), "Combinatorial Algorithms", Second Edition, Academic Press, Chapter 4.
Applications:
    Combinatorial Analysis
Implementation Date:
    2008/4
Program:
     
    LET N = 8
    LET K = 3
    LET Y = RANDOM K-SET OF N-SET FOR I =  1  1  K
    PRINT Y
        

Date created: 1/12/2009
Last updated: 1/12/2009
Please email comments on this WWW page to alan.heckert@nist.gov.