Skip to content

pactole-js


Class: EuroMillions

Defined in: lottery/euromillions.ts:26

Class representing the EuroMillions lottery.

EuroMillions is a lottery game where players choose 5 main numbers from 1 to 50 and 2 star numbers from 1 to 12. The total number of combinations is 2,118,760 for the main numbers and 66 for the star numbers. In total, there are 139,838,160 possible combinations.

Draws take place every Tuesday and Friday.

Example

const lottery = new EuroMillions();
lottery.drawDays; // DrawDays instance
lottery.combinationFactory; // EuroMillionsCombination factory
lottery.getCombination({ numbers: [1,2,3,4,5], stars: [1,2] });

Extends

Constructors

Constructor

new EuroMillions(): EuroMillions

Defined in: lottery/euromillions.ts:27

Returns

EuroMillions

Overrides

BaseLottery.constructor

Accessors

combinationFactory

Get Signature

get combinationFactory(): CombinationFactory

Defined in: lottery/base-lottery.ts:94

Return the combination factory associated with this lottery.

Example
const lottery = new BaseLottery({ combinationFactory: EuroMillionsCombination });
const factory = lottery.combinationFactory; // EuroMillionsCombination factory function
const combination = factory({ numbers: [1, 2, 3], stars: [1] }); // EuroMillionsCombination instance
Returns

CombinationFactory

The factory function used to create combinations.

Inherited from

BaseLottery.combinationFactory


drawDays

Get Signature

get drawDays(): DrawDays

Defined in: lottery/base-lottery.ts:78

Return the DrawDays instance associated with this lottery.

Example
const lottery = new BaseLottery({ drawDays: [Weekday.MONDAY, Weekday.THURSDAY] });
lottery.drawDays; // DrawDays instance with Monday and Thursday
Returns

DrawDays

The DrawDays instance configured for this lottery.

Inherited from

BaseLottery.drawDays

Methods

generate()

generate(options?): LotteryCombination[]

Defined in: lottery/base-lottery.ts:154

Generate a list of random lottery combinations from the configured combination factory.

Parameters

options?

Options controlling generation.

n?

number = 1

Number of combinations to generate (default 1).

partitions?

number = 1

Number of partitions to use when ranking/generating. (default 1).

Returns

LotteryCombination[]

An array of lottery combinations produced by the factory.

Example

const lottery = new BaseLottery({ combinationFactory: EuroMillionsCombination });
const combinations = lottery.generate({ n: 2 });

Inherited from

BaseLottery.generate


getCombination()

getCombination(components): LotteryCombination

Defined in: lottery/base-lottery.ts:171

Create a lottery combination from the provided components using the configured factory.

Parameters

components

Record\<string, CombinationInputOrRank>

Component values or ranks forwarded to the factory.

Returns

LotteryCombination

A lottery combination produced by the factory.

Example

const lottery = new BaseLottery({ combinationFactory: EuroMillionsCombination });
const ticket = lottery.getCombination({ numbers: [1, 2, 3, 4, 5], stars: [1, 2] });

Inherited from

BaseLottery.getCombination


getLastDrawDate()

getLastDrawDate(fromDate?, closest?): Date

Defined in: lottery/base-lottery.ts:114

Return the date of the last lottery draw according to the configured drawDays.

Parameters

fromDate?

Starting reference date. Accepted formats: - A Unix timestamp in seconds. - An ISO date string (YYYY-MM-DD). - A Date object. - A Weekday or other DayInput accepted by DrawDays.getLastDrawDate. If omitted or null, the current date is used.

DayInput | Weekday | null

closest?

boolean = true

Whether to return the closest draw date if fromDate is itself a draw day.

Returns

Date

A Date representing the last draw day on or before fromDate.

Throws

When fromDate is not a valid date input.

Throws

When fromDate string cannot be parsed.

Inherited from

BaseLottery.getLastDrawDate


getNextDrawDate()

getNextDrawDate(fromDate?, closest?): Date

Defined in: lottery/base-lottery.ts:134

Return the date of the next lottery draw according to the configured drawDays.

Parameters

fromDate?

Starting reference date. Accepted formats: - A Unix timestamp in seconds. - An ISO date string (YYYY-MM-DD). - A Date object. - A Weekday or other DayInput accepted by DrawDays.getNextDrawDate. If omitted or null, the current date is used.

DayInput | Weekday | null

closest?

boolean = true

Whether to return the closest draw date if fromDate is itself a draw day.

Returns

Date

A Date representing the next draw day on or after fromDate.

Throws

When fromDate is not a valid date input.

Throws

When fromDate string cannot be parsed.

Inherited from

BaseLottery.getNextDrawDate