Class: BoundCombination
Defined in: combinations/combination.ts:471
A class representing a bound combination of values.
BoundCombination extends Combination with numeric bounds and a fixed
component count used by lottery sub-components.
Param
The values of the combination. If an integer is provided, it is treated as a rank.
Param
The lexicographic rank of the combination.
Param
The start value of the combination range.
Param
The end value of the combination range.
Param
The maximum count of numbers in the combination.
Param
The total number of possible combinations.
Examples
const bound = new BoundCombination(10, { start: 1, end: 50, count: 5 });
bound.values; // e.g. [2, 3, 4, 5, 7]
const fixed = new BoundCombination([1, 2, 3], { start: 1, end: 50, count: 5 });
fixed.count; // 5
fixed.combinations; // 2118760
Extends
Constructors
Constructor
new BoundCombination(
values?,__namedParameters?):BoundCombination
Defined in: combinations/combination.ts:478
Parameters
values?
CombinationInputOrRank = null
__namedParameters?
Returns
BoundCombination
Overrides
Properties
_combinations
protectedreadonly_combinations:number
Defined in: combinations/combination.ts:476
_count
protectedreadonly_count:number
Defined in: combinations/combination.ts:474
_end
protectedreadonly_end:number
Defined in: combinations/combination.ts:472
_rank
protected_rank:number|null
Defined in: combinations/combination.ts:85
Inherited from
_start
protectedreadonly_start:number
Defined in: combinations/combination.ts:87
Inherited from
_values
protectedreadonly_values:Set\<number>
Defined in: combinations/combination.ts:83
Inherited from
Accessors
combinations
Get Signature
get combinations():
number
Defined in: combinations/combination.ts:560
Return the total number of possible combinations.
Example
Returns
number
Total combinatorial space.
count
Get Signature
get count():
number
Defined in: combinations/combination.ts:548
Return the configured count of numbers in the combination.
Example
Returns
number
Configured count.
end
Get Signature
get end():
number
Defined in: combinations/combination.ts:536
Return the end value of the combination range.
Example
Returns
number
End bound.
length
Get Signature
get length():
number
Defined in: combinations/combination.ts:180
Get number of values.
Example
Returns
number
Number of unique values in the combination.
Inherited from
rank
Get Signature
get rank():
number
Defined in: combinations/combination.ts:155
Get lexicographic rank.
If rank is not explicitly provided, it is computed lazily from values.
Example
Returns
number
Lexicographic rank.
Inherited from
start
Get Signature
get start():
number
Defined in: combinations/combination.ts:192
Get the starting offset of the combination.
Example
Returns
number
Start offset.
Inherited from
storedRank
Get Signature
get storedRank():
number|null
Defined in: combinations/combination.ts:168
Get the stored rank without triggering lazy rank computation.
Returns
number | null
Stored rank or null when it has not been set/computed yet.
Inherited from
values
Get Signature
get values():
CombinationValues
Defined in: combinations/combination.ts:137
Get sorted combination values.
Example
Returns
Sorted values.
Inherited from
Methods
[iterator]()
[iterator]():
Iterator\<number>
Defined in: combinations/combination.ts:444
Returns
Iterator\<number>
Inherited from
compares()
compares(
combination):number
Defined in: combinations/combination.ts:358
Compare this combination to another combination or rank.
Parameters
combination
Candidate combination/rank.
Returns
number
-1, 0, or 1.
Example
Inherited from
copy()
copy(
values?):BoundCombination
Defined in: combinations/combination.ts:594
Return a copy of the BoundCombination with optional modifications.
Parameters
values?
BoundCombinationCopyOptions = {}
Replacement values, rank, or input-with-rank payload.
Returns
BoundCombination
A new BoundCombination.
Example
const base = new BoundCombination([1, 2, 3], { start: 1, end: 50, count: 5 });
base.copy({ values: 15 }).values; // rank-derived bounded values
Overrides
equals()
equals(
combination):boolean
Defined in: combinations/combination.ts:257
Check whether this combination equals another combination or rank.
Parameters
combination
Candidate combination/rank.
Returns
boolean
true when values/rank are equal.
Example
Inherited from
generate()
generate(
n?):BoundCombination[]
Defined in: combinations/combination.ts:575
Generate random combinations within current bounds.
Parameters
n?
BoundCombinationGenerateOptions = {}
Number of combinations to generate.
Returns
BoundCombination[]
Generated combinations.
Example
const generated = new BoundCombination(null, { start: 1, end: 50, count: 5 }).generate({ n: 2 });
generated.length; // 2
get()
get(
index):number
Defined in: combinations/combination.ts:408
Get a value by index.
Parameters
index
number
Zero-based value index.
Returns
number
Value at index.
Throws
Thrown when index is out of bounds.
Inherited from
getValues()
getValues(
start?):CombinationValues
Defined in: combinations/combination.ts:237
Get values with an optional start offset transformation.
Parameters
start?
number
Optional target start offset.
Returns
Values adjusted to the requested start offset.
Example
Inherited from
hashCode()
hashCode():
number
Defined in: combinations/combination.ts:424
Get an integer hash representation.
Returns
number
Rank-based hash.
Example
Inherited from
includes()
includes(
combination):boolean
Defined in: combinations/combination.ts:292
Check whether this combination includes another combination or a value.
Parameters
combination
Candidate value(s).
number | CombinationInputValues | null | undefined
Returns
boolean
true when all candidate values are included.
Example
Inherited from
intersection()
intersection(
combination):Combination
Defined in: combinations/combination.ts:340
Get the intersection with another combination.
Parameters
combination
Candidate value(s).
CombinationInputValues | null | undefined
Returns
A new Combination containing shared values.
Example
Inherited from
intersects()
intersects(
combination):boolean
Defined in: combinations/combination.ts:318
Check whether this combination intersects another combination.
Parameters
combination
Candidate value(s).
CombinationInputValues | null | undefined
Returns
boolean
true when at least one value overlaps.
Example
Inherited from
similarity()
similarity(
combination):number
Defined in: combinations/combination.ts:388
Calculate similarity ratio with another combination.
Parameters
combination
Candidate values.
CombinationInputValues | null | undefined
Returns
number
Similarity ratio in [0, 1].
Example
Inherited from
toRepr()
toRepr():
string
Defined in: combinations/combination.ts:656
Render string representation.
Returns
string
Representation string.
Example
Overrides
toString()
toString():
string
Defined in: combinations/combination.ts:637
Render values with fixed-width formatting.
Returns
string
Human-readable combination string.