Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
ml-combinations
Advanced tools
Readme
Generate all possible combinations, which are all the unordered samples of size k, without replacement, from a set of n objects. The number of k-combinations is equal to the binomial coefficient:
Very low memory footprint even if the number of combinations to generate is high. Thank to generators, you can iterate over all possible samples, without creating a very large array.
$ npm install ml-combinations
// the package exports a generator function
const combinations = require('ml-combinations');
const options = { mode: 'index' };
// the generator function returns an iterator
var gen = combinations(2, 4, options);
// You can loop throw the iterator
for (let combination of gen) {
console.log(combination);
}
// Or use destructuring, if you want to manipulate the array with all possible sample combinations
console.log([...gen]); // [ [ 3, 2 ], [ 0, 2 ], [ 1, 2 ], [ 1, 2 ], [ 0, 2 ], [ 0, 1 ] ]
// Use mask mode instead of index mode (index mode is the default)
options.mode = 'mask';
gen = combinations(2, 4, options);
console.log([...gen]); // [ [ 0, 0, 1, 1 ][ 1, 0, 0, 1 ],[ 0, 1, 0, 1 ],[ 0, 1, 1, 0 ],[ 1, 0, 1, 0 ],[ 1, 1, 0, 0 ] ]
Phillip J Chase, `Algorithm 382: Combinations of M out of N Objects [G6]', Communications of the Association for Computing Machinery 13:6:368 (1970). To the article
FAQs
Generate all possible unordered samples of size m, without replacement, from a set of n objects
The npm package ml-combinations receives a total of 94 weekly downloads. As such, ml-combinations popularity was classified as not popular.
We found that ml-combinations demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.