Lotto 6/45 Odds and Number Generator: Lock and Exclude Numbers

PublishedUpdatedToolLotto 6/45 Number Generator

Contents
  1. Why You Should Know the Odds Behind Your Lotto Numbers
  2. How the Math and Fair Number Drawing Work
  3. Lotto Number Statistics Worth Knowing
  4. Summary
  5. Frequently Asked Questions

Why You Should Know the Odds Behind Your Lotto Numbers

Many people buy their weekly lottery tickets with a purely random quick pick. Others want to build their own combinations, using numbers they expect to show up (fixed numbers) or leaving out numbers they think are unlikely to appear (excluded numbers).

The problem is that few people know how fixed and excluded numbers actually shrink the total number of possible combinations. Fewer still know how to draw from the remaining candidates fairly, so that no number gets picked more often than the others. Below, we walk through the math and then the actual process of generating a combination.


How the Math and Fair Number Drawing Work

Total Combinations: C(45, 6)

Lotto 6/45 uses a combination structure. You choose 6 different whole numbers from 1 to 45, with no repeats and in any order.

In math, the formula for choosing k items from n items, with order ignored, is:

C(n, k) = n! ÷ (k! × (n - k)!)

Plug in the Lotto 6/45 values and you get:

C(45, 6) = (45 × 44 × 43 × 42 × 41 × 40) ÷ (6 × 5 × 4 × 3 × 2 × 1)

The numerator (45 × 44 × 43 × 42 × 41 × 40) is 5,864,443,200, and the denominator (6!) is 720. So the total number of combinations is:

C(45, 6) = 5,864,443,200 ÷ 720 = 8,145,060

That means the mathematical probability of winning first prize is exactly 1/8,145,060 (about 0.0000123%). In other words, you would have to buy all 8,145,060 different combinations to be certain that one of them wins first prize.

How Fixed and Excluded Numbers Reduce the Combinations

When you pick numbers you must have (fixed numbers) or numbers you never want (excluded numbers), both the candidate pool and the number of open slots shrink.

Say the total count of numbers is 45, the count you pick is 6, the number of fixed numbers is m (0 ≤ m ≤ 6), and the number of excluded numbers is e. The m fixed numbers already take up m of the 6 slots, so (6 − m) slots remain. Take away the e excluded numbers and the m fixed numbers, and (45 − m − e) candidate numbers remain. The reduced number of combinations is then:

Possible combinations = C(45 − m − e, 6 − m)

Example 1. 2 fixed numbers, 5 excluded numbers The remaining pool is 45 − 2 − 5 = 38 numbers, and the open slots are 6 − 2 = 4. The calculation is:

C(38, 4) = (38 × 37 × 36 × 35) ÷ (4 × 3 × 2 × 1) = 2,714,040 ÷ 24 = 73,815

With just 2 fixed numbers and 5 excluded numbers, the total drops from 8,145,060 to 73,815.

Example 2. 3 fixed numbers, 10 excluded numbers The remaining pool is 32 numbers, and the open slots are 3. The calculation is:

C(32, 3) = (32 × 31 × 30) ÷ (3 × 2 × 1) = 29,760 ÷ 6 = 4,960

The more fixed and excluded numbers you add, the faster the number of combinations falls.

Drawing Numbers Fairly with the Fisher-Yates Shuffle

After you narrow the pool, what matters most is fairness: every remaining number should have the same chance of being picked.

A common approach is to pick numbers one at a time with Math.random() and throw out duplicates. This can introduce bias (modulo bias) that makes certain numbers come up more often. It can also make a while loop spin needlessly when already-picked numbers keep coming back.

The Fisher-Yates (Knuth) shuffle randomizes an array of size N completely in O(N) time. It guarantees that every element has an exactly equal probability of landing in every position, 1/N!. Here is how it works:

  1. Create an array P that holds the candidate numbers.
  2. Walk backward through the array, from the last index (i = N − 1) down to i = 1.
  3. Pick a random integer index j between 0 and i.
  4. Swap the elements at P[i] and P[j].
  5. After the shuffle, take as many numbers as you need from the front of the array, in order.

The popular "semi-auto" option when you buy a ticket (some numbers fixed, the rest random) uses the same principle. First, validate the fixed and excluded numbers you entered. Next, take all the numbers from 1 to 45 and remove the fixed set and the excluded set to build the candidate pool. Then apply the Fisher-Yates shuffle to that pool and draw the number you need. Finally, merge those with the fixed numbers and sort in ascending order. That gives you the final combination.

Try It Yourself: A TypeScript Implementation

Here is a working example of a function that generates a Lotto combination with fixed-number and excluded-number filtering and a Fisher-Yates shuffle.

/**
 * Custom Lotto 6/45 combination generator
 * @param fixedNumbers Array of fixed numbers that must be included (0 to 6 numbers)
 * @param excludedNumbers Array of numbers to exclude
 * @returns Array of 6 Lotto numbers sorted in ascending order
 */
function generateLottoNumbers(
  fixedNumbers: number[] = [],
  excludedNumbers: number[] = []
): number[] {
  // 1. Remove duplicates and convert to Sets
  const fixedSet = new Set(fixedNumbers);
  const excludedSet = new Set(excludedNumbers);

  // 2. Validate the input
  if (fixedSet.size > 6) {
    throw new Error("You can set a maximum of 6 fixed numbers.");
  }

  for (const num of fixedSet) {
    if (excludedSet.has(num)) {
      throw new Error("The number (" + num + ") appears in both the fixed and excluded numbers.");
    }
  }

  // 3. Build the remaining candidate pool
  const candidatePool: number[] = [];
  for (let i = 1; i <= 45; i++) {
    if (!fixedSet.has(i) && !excludedSet.has(i)) {
      candidatePool.push(i);
    }
  }

  const neededRandomCount = 6 - fixedSet.size;

  if (candidatePool.length < neededRandomCount) {
    throw new Error("Too many excluded numbers to form a 6-number combination.");
  }

  // 4. Apply the Fisher-Yates shuffle
  const shuffled = [...candidatePool];
  for (let i = shuffled.length - 1; i > 0; i--) {
    const j = Math.floor(Math.random() * (i + 1));
    [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
  }

  // 5. Draw the random numbers and merge them with the fixed numbers
  const selectedRandom = shuffled.slice(0, neededRandomCount);
  const finalCombination = [...Array.from(fixedSet), ...selectedRandom];

  // 6. Sort in ascending order and return
  return finalCombination.sort((a, b) => a - b);
}

// Usage example: fixed numbers [7, 14], excluded numbers [3, 10, 21, 35, 42]
const myLottoNumbers = generateLottoNumbers([7, 14], [3, 10, 21, 35, 42]);
console.log("Generated Lotto numbers:", myLottoNumbers);

With the Fisher-Yates shuffle, as in the code above, you avoid needless repeated draws. You get a fair random combination in O(N) time every time.

You can write and run the code yourself. But if you would rather set fixed and excluded numbers with a few clicks and generate several sets at once, try our Lotto 6/45 Number Generator.

Lotto 6/45 Number Generator

Free · Lock and exclude numbers · Fair Fisher-Yates random picks


Lotto Number Statistics Worth Knowing

Mathematically, all 8,145,060 combinations have exactly the same chance of winning. Still, the statistics from past winning numbers show a few patterns.

Item

Statistic

Odd/even ratio 3:3 (3 odd, 3 even)

About 33% of all draws

Odd/even ratio 4:2 (4 odd, 2 even)

About 25%

Odd/even ratio 2:4 (2 odd, 4 even)

About 23%

Odd/even ratio 5:1 (5 odd, 1 even)

About 9%

Odd/even ratio 1:5 (1 odd, 5 even)

About 7%

Odd/even ratio 6:0 (all odd)

About 1.2%

Odd/even ratio 0:6 (all even)

Under 1%

Number sum in the 100–170 range

More than 80%

At least one pair of consecutive numbers

About 53%

In other words, balanced odd/even ratios such as [3:3], [4:2], and [2:4] make up most winning combinations.

Spread matters too. Split the 45 numbers into five groups of ten (1–10, 11–20, 21–30, 31–40, and 41–45). The more evenly your numbers fall across these groups, the more your combination looks like a real winning draw. Historically, it has been rare for all six numbers to land in just one or two groups.

Runs of three or more consecutive numbers (for example, 14, 15, 16) also show up less often.

These statistics don't change the odds of any particular number winning. They're just information you can use when building a combination.


Summary

Lotto 6/45 has 8,145,060 possible combinations. When you set fixed numbers and excluded numbers, that total drops sharply. When you draw numbers from the smaller pool, you need a fair algorithm such as the Fisher-Yates shuffle. That keeps any one number from being picked more often than the others.

Statistics like the odd/even ratio and the number sum don't change your odds of winning. They're just reference points as you build a combination. You can code the calculation yourself. But a tool that automates fixed numbers, excluded numbers, and the shuffle lets you build combinations faster.

Lotto 6/45 Number Generator

Free · Lock and exclude numbers · Fair Fisher-Yates random picks


Frequently Asked Questions

How do I use the Lotto 6/45 Number Generator?

On the 45-number grid, click to toggle the numbers you want to include (fixed numbers, shown in green) and the numbers you want to exclude (excluded numbers, shown in red). Then choose how many sets to generate (1 to 5 games) and click Generate Numbers. The results screen shows your combinations, along with the odd/even breakdown and a sum range analysis.

Why does the tool show the number sum (Sum Range)?

In the overall distribution of past Lotto 6/45 winning numbers, the sum of the six numbers falls between 100 and 170 in more than 80% of draws. The tool shows whether each generated combination's sum falls in that range, so you can see at a glance if it's a balanced combination.

Does setting fixed numbers improve my odds of winning?

No. Every one of the 8,145,060 possible Lotto 6/45 combinations has exactly the same chance of winning: 1 in 8,145,060, no matter how you build it. Fixing numbers just means you play only the subset of combinations that include the numbers you want. It doesn't mathematically raise the odds of the combination you end up with. There is a practical benefit, though. If you buy several sets at once, locking in your preferred numbers makes it easier to narrow down and manage your candidates.

Are the numbers this tool generates random?

Yes. The tool generates combinations with the Fisher-Yates shuffle algorithm. It draws numbers fairly from your candidate pool, with no bias toward picking certain numbers more often.


The information in this guide is provided for mathematical combination calculations and statistical reference only.

This article was adapted from our Korean original. Read the Korean original

Related articles

  1. What Is a MAC Address? Random MACs and Wi-Fi TrackingA MAC address is a fixed 48-bit hardware ID, which makes it easy to track a device across Wi-Fi networks. Here's how random MAC addresses break that link.
  2. Meta Description vs og:description: What Goes WhereLearn how meta description, og:description, and twitter:description differ, which platforms read each tag, and how to check your page source in seconds.
  3. What Is a Passphrase? Password Strength by EntropyWe do the math on why eight random words can beat a short, complex password, and how password entropy in bits is calculated.
  4. 8 vs 12 character password: 2.6 trillion times more combinationsSee how password length and character types change brute-force time, with a combination-count table and a 2.6 trillion gap between 8 and 12 characters.
  5. CLS Image Layout Shift: Why It Happens and How to Fix ItWhy images push content around as they load, and how setting width, height, or a same-size placeholder image keeps your layout from shifting.
  6. QR code grid pattern: why it looks that way and why it scansQR codes look like random black-and-white grids for a reason. See what finder patterns do and how error correction keeps a code scannable when covered or colored.

Related tools