This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes random.math question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "random.math question" Watch "random.math question" New topic
Author

random.math question

Mary Anderson
Greenhorn

Joined: Feb 25, 2005
Posts: 6
hello ppl

sorry for my silly question but i'm a newbie
and I think I've confused the .math thing

i want to make a sort program that chose random numbers
to see how things work but it seemed that i confused it a bit

what i though is something like
a for in the beginning like for (i=0; i <10 ; i++
then i though of using the try catch something like
try then i've got troubles about the syntact of random.math and the a catch to hold exceptions and then a system print out with the number it was chosen.


is the way that i'm thinking correct i'm just trying to learn what I'm seeing in the book I bought but sometimes I need to discuss things

sorry for bothering you
Thank you
M.A.
Prashanth Lingala
Ranch Hand

Joined: Nov 13, 2004
Posts: 66


Look carefully at the System.out.println() statement,
if i dont put Math.random() * 10in parentheses, i will get the same values consistently...Think about it...


Have A Nice Day !!!
Mary Anderson
Greenhorn

Joined: Feb 25, 2005
Posts: 6
I see that no try-catch is necessarily needed to do that simple thing (which although caused me troubles )
what I'm seeing for the first time is the 1 in the beggining what I also didn't do is to put the int in ()

thank you very much
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
If you need more help on this particular program, and when you need help in the future, you should post some code along with the verbal description of what you are trying to do. Code is a much more precise way of illustrating what you are having problems with. Also, when we try to help you, we can talk about the code in a much more precise way, whereas our help may be a bit vague when it comes to trying to decipher the verbal description on it's own. For more information about how to ask effectively questions, you should visit some of the links given in the related section in our FAQ. If you follow the advice given here, more people are likely to take the time to help you. Also, the turn around time will be minimized as many of the suggestions are an effort to help avoid any confusion during communication.

Anyway, I'll get off my soap box now

Keep Coding!

Layne


Java API Documentation
The Java Tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: random.math question