Skip to content
Win4Generator, written in JavaFX. Uses Selenium for webapp parsing.
Java CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A Win4 Lotto Number Generator implemented in JavaFX, along with Selenium for website parsing.

The central idea behind this application is to provide randomly generated lotto numbers that have not been used in the past, under the assumption that previous lotto numbers are not used. From a pure probability standpoint, this idea is mathematically incorrect, but makes for an interesting idea nonetheless.

Since the page for finding the previous winning Win4 numbers only really works by interfacing with a web UI (need to interact with a web app), I used Selenium's PhantomJSDriver to virtually browse and parse the webpage for the winning numbers, which is then saved in the "data" directory as a .txt file.

Image of the Win4Generator GUI

NOTE: This software was written for the Win4 page as it appeared from 2016-2017. This application may not update correctly with the current version of the page, should it have changed.


Win4 Number Generation:

Generates 4 numbers, excluding numbers that have won in the past.


Put simply, clicking the "Update" button will update the data/winners.txt file. The latest date to which the data has been updated to is also listed on the main GUI window, useful for knowing whether the data needs updating or not.


Clicking the gear in the top right will launch the access to the settings:

Image of the Settings GUI

Order Matters

By default, the program will have this setting checked off. The Win4 numbers follow a particular order, and if one wishes to exclude number combinations that have been used (regardless of order), this setting can be toggled to off. Therefore, keeping this on will simply reject randomly generated lotto numbers if they match exactly, but not if they use the same pool of integers.

Future Implementation

  • Ability to turn filtering of previously used values entirely
  • Updating to work with the current version of of the past winning numbers page


A. "Win 4 Past Winning Numbers | New York Lottery":

DISCLAIMER: Win4 and the Win4 logo, as well as the names and logos of related content, are the property of New York Lottery, and any other parties not mentioned hitherto.
You can’t perform that action at this time.