Lotto Number Generator

Introduction

This is a personal project that generates random integers that can be used in the lottery in various countries.

It has the following features:

  • Let the user decide the maximum and minimum figures for a pool of numbers.
  • Let the user decide how many numbers to draw from the pool.
  • Give the user the option to draw at least 1 random integer from a second pool of numbers.
  • The user can also adjust the maximum and minimum figures for the second pool of numbers.
  • Let the user adjust the number of sets of random integers to be generated for multiple games.
  • Give the user the option to sort the random integers generated.

How to install and run Lotto Number Generator

  1. In github, click on the green "clone or download" button
  2. Choose "download zip" in the dropdown menu under the button
  3. Choose destination for download
  4. Extract the zip file in the directory of your choice
  5. Open randNums.html with your web browser
  6. In your web browser, enable JavaScript in the window or tab with randNums.html

Usage instructions

At the text-box like inputs, such as “How many games do you want to play?”, only integers are valid. The “Reset” button can be used any time to clear all inputs and error messages. The creator of Lotto Number Generator recommends the user to take the following steps to generate numbers for lottery style gambling games.

Step 1: At the input “How many games do you want to play?”, enter a positive integer.

Step 2: If you wish to have your lotto numbers sorted, check the appropriate checkbox.

Step 3: If your gambling game invokes the use of special numbers, such as a “Powerball”, then check the appropriate checkbox.

Step 4: At the input “What is the smallest number you can choose in your game?”, enter any integer. Usually it’s 1, because this is usually the lowest number you can choose in most lottery style gambling games.

Step 5: At the input “What is the largest number you can choose in your game?”, enter any integer higher than what you have entered at the previous step.

Step 6: At the input “How many "normal" numbers do you need to choose per game?”, enter the amount of numbers you need to choose for one game. For example, if you are playing Ozlotto in Australia, this would be 7. The number you enter should be greater than zero but smaller than the number you entered at step 5.

If your gambling game does not use special numbers, skip to step 10.

Step 7: At the input “What is the smallest special number that you can choose?”, enter any integer. Usually it’s 1, because this is usually the smallest special number you can choose in most lottery style gambling games.

Step 8: At the input “What is the largest special number you can choose?”, enter any integer higher than what you have entered at the previous step.

Step 9: At the input “How many special numbers do you need?”, enter an integer that is greater than zero but smaller than the number you entered at step 8.

Step 10: Click on the button “Generate lotto numbers”. If 1 or more error messages appear, try to make corrections at the corresponding inputs then click on “Generate lotto numbers” again. If you wish to clear all inputs and error messages, click on the “Reset” button. If you wish to generate new lotto numbers using the same inputs, click on “Generate lotto numbers” again.

Background

Also included in this repo is randNumsBackendOnly.js. A backend only, random number generator with hardcoded input values, written in Node.js. randNumsBackendOnly.js was how this project started out as, a backend only commandline program. If you wish to use randNumsBackendOnly.js, you will need Node.js installed. It can be downloaded from the official site:

https://nodejs.org/en/

Once Node.js is installed, navigate to the directory where you have installed randNumsBackendOnly.js. Open a terminal window at that directory and type in:

node randNumsBackendOnly.js.

At the moment this project is still a work in progress and only has basic styling to separate random numbers generated. The intention is to improve styling for the frontend.