Micheal jayawardane

Greenhorn

Posts: 3

posted 13 years ago

can anybody please tell me whether any probabilty calculation could be done using the java Math class.

e.g:- how do you simulate the possibilties of a ships arrival at a dock yard, which has a 2/10 chance of landing durring the first hour since commencement. 5/40 chance of doicking durring the second hour since commencement and 2/20 at the third hour since commencement.

Or else could using threads do the same thing specified.

Thankyou.

e.g:- how do you simulate the possibilties of a ships arrival at a dock yard, which has a 2/10 chance of landing durring the first hour since commencement. 5/40 chance of doicking durring the second hour since commencement and 2/20 at the third hour since commencement.

Or else could using threads do the same thing specified.

Thankyou.

**Probability**
Ram Mohan

Ranch Hand

Posts: 44

posted 13 years ago

not too sure that i understood ur problem...but the Math class has some random number generator functions.

Use Math.Random() and Math.nextDouble() to generate random numbers, the probability factors that you want should probably be coded...

Use Math.Random() and Math.nextDouble() to generate random numbers, the probability factors that you want should probably be coded...

If quitters never win, and winners never cheat, who's the idiot that said: Quit while you're ahead?