Home About Projects Resume Contact

Keno: Source Code

(Random Number Generator)
This is an unfinished project that I have started in my free time. It is written in Java and based on the Massachusetts state lottery game Keno. You're able to pick up to 12 numbers and then the computer picks randomly generator numbers (20 to be exact) from 1 to 80. It then displays the numbers. It then checks to see if you have won. What I am planning is to add a game running every 4 minutes, betting system with a central bank as well as individual player money.

import java.util.Random;
import java.util.ArrayList;

public class Computer {

	public Computer() { }

	//Bank bank = new Bank();

	Random random = new Random();
	//ArrayList randomNumbers;
	ArrayList randomNumbers = new ArrayList(80);
	public void numberDraw(){


		for(int n = 0; n < 20; n++)
		{
			randomNumbers.add(random.nextInt(80)+1);

			if(0 != n)
			{
				for(int i = 0; i < n; i++)
				{
					if(randomNumbers.get(n) == randomNumbers.get(i))
					{
						randomNumbers.remove(n);
						n--;
					}
				}
			}

		}
		//Debug
		for(int n = 0; n < 20; n++)
		{
			System.out.print(randomNumbers.get(n) + " ");
		}
		System.out.println("");
	}

	public ArrayList getNumberDraw()
	{
		return randomNumbers;
	}


}

ShaneKaplan.com