Re: can this code be improved
- From: Luke Webber <luke@xxxxxxxxxxxxx>
- Date: Thu, 17 Aug 2006 01:12:42 GMT
Print Guy wrote:
Hi all.[snip]
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)
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
.
- References:
- can this code be improved
- From: Print Guy
- can this code be improved
- Prev by Date: Re: Open a file embbeded in a jar file
- Next by Date: Re: WebSphere 1.0.1.2 CE and Axis
- Previous by thread: Re: can this code be improved
- Next by thread: Re: can this code be improved
- Index(es):
Relevant Pages
|