PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Jelle Sebreghts   PHP BitMask Generator   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP BitMask Generator
Generate all bitmasks with a minimum amount of 1s
Author: By
Last change: Changed travis badge to develop branch.
Date: 7 years ago
Size: 1,110 bytes
 

Contents

Class file image Download

BitMaskGenerator

Build Status Code Climate Test Coverage Issue Count

Usage:

use Jelle_S\Util\BitMask\BitMaskGenerator;
$length = 5;
$minPositives = 2;
// BitMaskGenerator that generates bitmasks with a length of 5 and at least two
// positives (1's).
$generator = new BitMaskGenerator($length, $minPositives);
while ($mask = $generator->getNextMask()) {
  print $mask . "\n";
}

Output:

00011
00101
00110
01001
01010
01100
10001
10010
10100
11000
00111
01011
01101
01110
10011
10101
10110
11001
11010
11100
01111
10111
11011
11101
11110
11111