Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Help coderanch get a
new server
by contributing to the
fundraiser
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Devaka Cooray
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
paul wheaton
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Carey Brown
Mikalai Zaikin
Bartenders:
Lou Hamers
Piet Souris
Frits Walraven
Forum:
Beginning Java
How do i choose a random Integer Object
Jere Johnson
Greenhorn
Posts: 28
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How would i execute a random number for an Integer
array?
thanks for the help
Integer [ ] data = new Integer [10}; for (int i=1; i<data.length; i++){ data[i] = (int)(Math.random()*1000)+10; // here is the problemo intTree[i] = new BTNode (data[i], null, null); }
[ December 02, 2003: Message edited by: Jere Johnson ]
Diapers are the best invention
Martin Coetzee
Greenhorn
Posts: 21
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Try This...
Integer [ ] data = new Integer [10};
java.util.Random random = new java.util.Random();
for (int i=1; i<data.length; i++){
data[i] = new Integer(random.nextInt());
}
Greetings from South Africa
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Regarding PriorityQueue
about random.next int();
Getting return value using Callable and Future
More...