[
https://issues.apache.org/jira/browse/RNG-62?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16694882#comment-16694882
]
ASF GitHub Bot commented on RNG-62:
-----------------------------------
GitHub user aherbert opened a pull request:
https://github.com/apache/commons-rng/pull/15
RNG-62: Added a CombinationSampler
Complements the PermutationSampler as the sample order is C(n, k) rather
than P(n, k). Can be used for faster subset sampling if the subset order
is not important.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/aherbert/commons-rng feature-RNG-62
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/commons-rng/pull/15.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #15
----
commit 974b86453c986b2564afe8f1b58d5dec820e574a
Author: Alex Herbert <a.herbert@...>
Date: 2018-11-21T15:15:28Z
RNG-62: Added a CombinationSampler
Complements the PermutationSampler as the sample order is C(n, k) rather
than P(n, k). Can be used for faster subset sampling if the subset order
is not important.
----
> CombinationSampler
> ------------------
>
> Key: RNG-62
> URL: https://issues.apache.org/jira/browse/RNG-62
> Project: Commons RNG
> Issue Type: New Feature
> Reporter: Alex D Herbert
> Priority: Minor
>
> 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.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)