Results 1 to 2 of 2
Thread: A question of calculation
- 01-25-2012, 12:50 AM #1
Member
- Join Date
- Jan 2012
- Posts
- 1
- Rep Power
- 0
A question of calculation
Hi all
I am new to Java which is why i am posting here...
I have a thread that throws 5000 at the code below...
I would very much appreciate advice on what the emboldened code does with 5000?Java Code:double slpAmnt = (double)Math.random()*5000; // work out sleep amount try { sleep((long)slpAmnt);// sleep for sleep amount } catch (Exception e1) { e1.printStackTrace(); }
I think i understand the Math.random()*5000 produces anything in the range of 0 to 5000, but am unsure what the rest does?
Many thanks for any repliesLast edited by DarrylBurke; 01-25-2012 at 05:28 AM. Reason: Removed silly [B] tags used within the code tags
- 01-25-2012, 01:51 AM #2
Re: A question of calculation
Try reading the API doc for the sleep() method to see what it does.
Java Platform SE 6
Similar Threads
-
Help with calculation - any help will be great!
By venictus in forum AndroidReplies: 13Last Post: 08-19-2011, 12:23 AM -
Calculation with char
By chuckbalzer in forum New To JavaReplies: 7Last Post: 09-20-2010, 05:29 PM -
Help with the calculation of a variable.
By rarschach in forum New To JavaReplies: 14Last Post: 01-24-2010, 02:50 PM -
Problem with Calculation ....
By danny000 in forum New To JavaReplies: 1Last Post: 04-15-2008, 02:42 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks