File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes coding problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

coding problem

fozia inam

Joined: Nov 27, 2001
Posts: 4
could anybody tell me the coding for storing 20 unique random numbers in an array.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

This sounds like homework (there is an unofficial policy of not giving complete homework solutions)
You need to instatiate an array of integers large enough to hold 20 items
You need to loop through the list and put a new random integer in each slot (see java.util.Random.nextInt())
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
We don't want to rob you of an education by writing the solution for you. Show us what you have and tell us what's not working. Ask a specific question. Then we can help you.

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

this thread continued here.
I agree. Here's the link:
subject: coding problem
It's not a secret anymore!