I need to write a Java program that uses a Monte Carlo algorithm to calculate the
probability that next week’s lottery draw won’t have any consecutive
pairs of numbers (e.g. 8 and 9 or 22 and 23). 6 numbers are drawn
from 1 to 45.
And your point is? If you need help with anything, post what you have so far.
Just to be clear: when I say "what you have so far", in case you missunderstood it, I didn't mean "post your assignment and we'll do it for you."
The rules of Daniweb demand that you at the very least show that you've done some effort to write the code yourself.
stultuske may not be the most diplomatic person here, but his message is right...
DaniWeb Member Rules (which you agreed to when you signed up) include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules
You said that you need to calculate, the probability, but I do not see any logic for this. Your logic, just generates a random number and prints it. Try to put more thought into it.
Hint: You will need a bunch of random numbers since its a lottery. Not numbers from 1 to 7.
newcoder: "please use functions" ..
since Java doesn't have functions, that might pose bit of a problem.
mickdrealist: you never store the 'random' numbers you generate, so how would you be able to compare previous values to the new one(s) ?