Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Probability  RSS feed

 
Micheal jayawardane
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Probability
 
Ram Mohan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!