Uploaded image for project: 'Commons RNG'
  1. Commons RNG
  2. RNG-62

CombinationSampler

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Implemented
    • None
    • 1.2
    • sampling
    • None

    Description

      The sampling module contains a PermutationSampler. There is scope to create a CombinationSampler too.

      https://en.wikipedia.org/wiki/Permutation

      https://en.wikipedia.org/wiki/Combination

      If the order of the returned sample is not important then a combination can be generated faster than a permutation. 

      The sample can be optimised by only performing the first k or (n-k) steps from a full Fisher-Yates shuffle from the end of the domain to the start. The upper positions will then contain a random permutation sample from the domain. The lower half is then by definition also a random sample (just not in a random order). The sample is then picked using the upper or lower half depending which makes the number of steps smaller.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              aherbert Alex Herbert
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: