[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
Need help  XML
Forum Index » Java Programming
Author Message
klopine

Newbie

Joined: 03/23/2006 03:31:45
Messages: 2
Offline

Actually I am trying to make this calculating game. I want compiler or my program to ask these questions to the user randomly and simultaneously i want compiler to generate questions itself again on random basis. Can anyone help me with this. Would be great if lil bit piece of code.
I know there is a class called Random class but i dont really know how it works

Thanks
destin

Newbie
[Avatar]
Joined: 01/07/2006 19:13:04
Messages: 224
Offline

When using the Random class, you will first have to make an instance of it.

This creates an instance with the default seed (which I believe is System.currentTimeMillis()). You can change the seed by passing in some arguments.

Then, the random class supplies a number of methods to generate random numbers. For random integers, use the nextInt(int) method.

randomNum will be a number greater than or equal to 0 and less than num.

Hope this helps.
[Email]
klopine

Newbie

Joined: 03/23/2006 03:31:45
Messages: 2
Offline

Thanks..
I will have a try as soon as i get home Thanks
 
Forum Index » Java Programming
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle