Re: can this code be improved



Print Guy wrote:
Hi all.

To most of you, what I have been working on is probably trivial and
easy, but it's taken me the good part of a week working 2 or 3 hrs a
day to finally figure out how to do what I needed to do.
Here in Canada, we have a lottery called 6-49. You pick 6 numbers
between 1 and 49. Those numbers are put on a ticket and there is a
draw twice a week.

I wanted to come up with a statistically solid way to pick my numbers
so I figured that if I were to pick 6 numbers 1,000,000 times and count
the number of times each number is selected, the top six would be good
numbers to bet on during the lottery.

With that being said, I thought I could write a Java program to do the
job. It proved to be a bit more difficult than I thought it would be;
the hardest part being ensuring that each of the 6 numbers were unique.

Here is my code. What I am hoping for is some constructive criticism
which could help me to make the code more efficient.

(Normally I would not comment my code so much, but I wanted you to see
what I was trying to accomplish)
[snip]

If you're asking this just as a Java question, then there are certainly things you can do to improve on it. But I have to point out that you're not modelling the real world here. You'll mostly be testing for bias in the Java random number generator, when you should really be testing for bias in whatever process/equipment the lottery agency is using.

If they keep historical records for downloading (as our Australian agency does), you'd be better served to download that and massage it.

Cheers,
Luke
.



Relevant Pages

  • Re: How to set values in registry
    ... problems downloading and upgrading as well as many other problems. ... that I always get when I try to download java and found that it ... I wouldn't worry about the registry at all. ... If you'd rather not also install Google Toolbar or Desktop, ...
    (microsoft.public.windowsxp.general)
  • Re: Force browser to open a file (rather than save/open/cancel)
    ... exe directly to their computers, instead I would like to is force them ... Get the users to submit their location, go around with the installer on ... web page but stop people from downloading them?" ... MSWindows programs Java doesn't usually litter files all over the hard ...
    (comp.lang.java.programmer)
  • Re: Installing a JRE plug-in
    ... executables. ... I found a site that a Java applet that did the same thing. ... since I was not downloading and executing the program (the ... I've found a similar use for client side Java on public access ...
    (Debian-User)
  • Re: JAVAMIX P2P - needs Java developers
    ... > If you are interested in Java and in File Sharing, ... > allow to share files with other users, but the central server doesn't ... > Governments try to block file sharing asking IP from Central Servers ... > and monitorating traffic and files you are downloading. ...
    (comp.lang.java.developer)
  • Re: How To Install Java
    ... |I was informed that I no longer have jave on my computer. ... | So I am unable to look up some websites. ... | help in downloading and setting up Java please. ...
    (microsoft.public.windowsxp.general)