aspose file tools*
The moose likes Beginning Java and the fly likes Generating random numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Generating random numbers" Watch "Generating random numbers" New topic
Author

Generating random numbers

David JonesK
Greenhorn

Joined: Mar 11, 2004
Posts: 6
hi, i'm really stuck, can anyone tell me how to generate random numbers between 100 and 200 in java.
thank you
john smith
Ranch Hand

Joined: Mar 04, 2004
Posts: 75
This would do it:
Vicken Karaoghlanian
Ranch Hand

Joined: Jul 21, 2003
Posts: 522
I want to add one more thing...
Although John's code is correct, 200 is never reached, the closest number you will get is 199.999...


- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. - What truth? - That there is no spoon!!!
David JonesK
Greenhorn

Joined: Mar 11, 2004
Posts: 6
Thanks
john smith
Ranch Hand

Joined: Mar 04, 2004
Posts: 75
Fair point Vicken - I hadn't noticed that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generating random numbers