Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Customizable NZ Lotto Powerball number generator using historical data analysis and weighted probability. Features smart number selection with spread control, range bias (left/right/middle), consecutive number preferences, and duplicate detection to ensure unique combinations never previously drawn.

Notifications You must be signed in to change notification settings

Jomar77/LottoNz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

33 Commits

Repository files navigation

LottoNz Smart Picker

A modern, data-driven lottery number generator using weighted algorithms based on historical NZ Lotto Powerball data.

Project Overview

This project consists of two main components:

Frontend (React App)

  • Modern React 18 + TypeScript application
  • Weighted number generation algorithm
  • Beautiful, responsive UI with Tailwind CSS
  • Customizable generation preferences
  • Real-time client-side processing

Backend (Python Scripts)

  • Data scraping and cleaning utilities
  • Excel to JSON conversion
  • Historical data analysis
  • Original Python-based lottery algorithm (lotto_V3.py)

Quick Start

Frontend Setup

cd Frontend
npm install
npm run dev

Visit: http://localhost:5173/LottoNz/

Update Data

cd Backend
python convert_to_json.py

Features

✨ Smart Number Generation

  • Frequency-weighted algorithm (1834 historical draws)
  • Spread control: tight (≀20), wide (β‰₯15), or mixed
  • Leaning bias: left (1-13), middle (15-25), or right (27-40)
  • Consecutive number preferences
  • Powerball: random 1-10

🎨 Modern UI

  • NZ-themed green/blue color scheme
  • Fully responsive design
  • Smooth animations
  • Collapsible preferences panel
  • Latest draw display

πŸ“Š Data-Driven

  • 1834 historical draws (2001-2025)
  • Real-time frequency analysis
  • Unique combination validation

Project Structure

LottoNz/
β”œβ”€β”€ Frontend/ # React application
β”‚ β”œβ”€β”€ src/
β”‚ β”‚ β”œβ”€β”€ App.tsx # Main component
β”‚ β”‚ β”œβ”€β”€ utils.ts # Generation algorithms
β”‚ β”‚ β”œβ”€β”€ dataService.ts # Data fetching
β”‚ β”‚ └── types.ts # TypeScript types
β”‚ β”œβ”€β”€ public/
β”‚ β”‚ └── results.json # Historical data (1834 draws)
β”‚ └── package.json
β”‚
β”œβ”€β”€ Backend/ # Python scripts
β”‚ β”œβ”€β”€ lotto_V3.py # Original Python algorithm
β”‚ β”œβ”€β”€ convert_to_json.py # Excel β†’ JSON converter
β”‚ β”œβ”€β”€ datacleaner.py # Data cleaning utilities
β”‚ └── lotto-data/
β”‚ └── december.xlsx # Source data
β”‚
└── README.md # This file

Algorithm

The weighted algorithm follows these steps:

  1. Calculate Frequencies: Count occurrences of each number (1-40) in historical data
  2. Apply Leaning Bias: Multiply weights by 2x for preferred range
  3. Weighted Selection: Use cumulative probability for random selection
  4. Validate Constraints: Check spread and consecutive requirements
  5. Generate Powerball: Random number 1-10 (no weighting)

Max 1000 attempts to find valid combination, falls back to default if needed.

Data Sources

  • Primary: Backend/lotto-data/december.xlsx (Excel format)
  • Converted: Frontend/public/results.json (JSON format)
  • Format: { date: string, numbers: number[], powerball: number }

Technologies

Frontend:

  • React 18, TypeScript, Vite
  • Tailwind CSS, Lucide React
  • Modern ES modules

Backend:

  • Python 3.x
  • pandas (Excel processing)
  • Selenium (web scraping - optional)

Development

Frontend Development

cd Frontend
npm run dev # Start dev server
npm run build # Build for production
npm run preview # Preview production build

Update Lottery Data

cd Backend
python convert_to_json.py

This reads lotto-data/december.xlsx and generates Frontend/public/results.json.

Deployment

  1. Build the frontend:
cd Frontend
npm run build
  1. Deploy Frontend/dist/ to your hosting service
  2. Configure for GitHub Pages (base path: /LottoNz/)

License

Private project - All rights reserved

Author

Created for NZ Lotto Powerball analysis and smart number generation. 🎰

A customizable New Zealand Lotto Powerball number generator that uses historical data analysis and weighted probability to generate unique lottery number combinations.

🌟 Features

  • Historical Data Analysis: Analyzes past Lotto Powerball draws to calculate number frequencies
  • Customizable Number Generation:
    • Spread Control: Choose tight, wide, or mixed number spreads
    • Range Bias: Favor low (1-20), high (21-40), or middle (15-25) numbers
    • Consecutive Numbers: Include or exclude consecutive number pairs
  • Duplicate Detection: Ensures generated combinations have never been drawn before
  • Multiple Entries: Generate multiple unique number sets in one run
  • Frequency Weighting: Uses historical frequency data to weight number selection

πŸ“‹ Requirements

  • Python 3.7+
  • pandas
  • openpyxl (for Excel file handling)

πŸš€ Installation

  1. Clone the repository:
git clone https://github.com/Jomar77/LottoNz.git
cd LottoNz
  1. Install required packages:
pip install pandas openpyxl
  1. Ensure you have the historical data file in the correct location:
    • File path: lotto-data/december.xlsx
    • Sheet name: Lotto Powerball

πŸ’» Usage

Running the Main Generator

python lotto_V3.py

Interactive Prompts

The script will guide you through customization options:

1. Number Spread Preference

  • a) Tight spread: Numbers close together (e.g., 12, 15, 17, 19, 21, 23)
  • b) Wide spread: Numbers spread far apart (e.g., 3, 12, 19, 28, 35, 40)
  • c) Mixed spread: Balanced distribution

2. Number Range Preference

  • l) Left leaning: Favors lower numbers (1-20)
  • r) Right leaning: Favors higher numbers (21-40)
  • m) Middle focused: Favors middle range (15-25)

3. Consecutive Numbers

  • y) Yes: Ensures at least one pair of consecutive numbers (e.g., 14, 15)
  • n) No: No preference for consecutive numbers

4. Number of Entries

  • Enter how many unique number sets you want to generate

Example Session

🎯 CUSTOMIZE YOUR LOTTERY NUMBERS 🎯
==================================================
1. Number Spread Preference:
 a) Tight spread (numbers close together)
 b) Wide spread (numbers spread out)
 c) Mixed spread (balanced)
Choose spread (a/b/c): b
2. Number Range Preference:
 l) Left leaning (favor lower numbers 1-20)
 r) Right leaning (favor higher numbers 21-40)
 m) Middle focused (favor middle numbers 15-25)
Choose leaning (l/r/m): m
3. Consecutive Numbers:
 y) Include at least one pair of consecutive numbers
 n) No preference for consecutive numbers
Include consecutive numbers? (y/n): y
4. How many number sets would you like? 3
πŸ”„ Generating 3 customized number set(s)...
============================================================
🎲 ENTRY #1 - YOUR CUSTOMIZED LOTTO NUMBERS 🎲
============================================================
Main Numbers: 12, 15, 16, 22, 28, 35
Powerball: 8
Number Spread: 23 (Range: 12 - 35)
Consecutive Numbers: βœ“ Yes
============================================================

πŸ“ Project Structure

LottoNz/
β”œβ”€β”€ lotto_V3.py # Main number generator (latest version)
β”œβ”€β”€ lotto_V2.py # Previous version
β”œβ”€β”€ lotto_V1.py # Initial version
β”œβ”€β”€ datacleaner.py # Data cleaning utilities
β”œβ”€β”€ heatmap_Anx.py # Visualization tools
β”œβ”€β”€ findline.py # Helper utilities
β”œβ”€β”€ lotto-data/ # Historical lottery data
β”‚ β”œβ”€β”€ december.xlsx # Required data file
β”‚ β”œβ”€β”€ data.csv
β”‚ └── lotto_results.csv
β”œβ”€β”€ dataScrape/ # Web scraping scripts
β”‚ β”œβ”€β”€ ds_selenium.py
β”‚ └── ds.py
└── *.ipynb # Jupyter notebooks for analysis

🎲 How It Works

  1. Data Loading: Reads historical Lotto Powerball results from Excel file
  2. Frequency Analysis: Calculates how often each number has been drawn
  3. Weighted Selection: Uses frequency data to create probability weights
  4. Bias Application: Applies user-selected biases (spread, range, consecutive)
  5. Validation: Checks generated combinations against historical data
  6. Uniqueness Guarantee: Ensures the combination has never appeared before

πŸ“Š Data Format

The Excel file should have the following columns:

  • Date
  • Draw Number
  • Num1, Num2, Num3, Num4, Num5, Num6 (Main numbers)
  • Bonus Number
  • Powerball Number

βš™οΈ Customization

To modify the data source, edit the file path in lotto_V3.py:

file_path = r"lotto-data\december.xlsx"
sheet_name = 'Lotto Powerball'

πŸ“ Additional Files

  • lotto.ipynb: Jupyter notebook for data exploration
  • powerball.ipynb: Powerball-specific analysis
  • gaus-alx.ipynb: Statistical analysis using Gaussian methods
  • heatmap_Anx.py: Generate heatmaps of number frequency

⚠️ Disclaimer

This tool is for entertainment purposes only. Lottery draws are random events, and past results do not influence future outcomes. Please gamble responsibly.

πŸ“œ License

This project is open source and available for personal use.

🀝 Contributing

Feel free to fork this repository and submit pull requests for improvements or new features!


Good luck! πŸ€

About

Customizable NZ Lotto Powerball number generator using historical data analysis and weighted probability. Features smart number selection with spread control, range bias (left/right/middle), consecutive number preferences, and duplicate detection to ensure unique combinations never previously drawn.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /