This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to read random cells from the Array of 2 dimentional. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to read random cells from the Array of 2 dimentional." Watch "How to read random cells from the Array of 2 dimentional." New topic
Author

How to read random cells from the Array of 2 dimentional.

murali kankanala
Ranch Hand

Joined: Nov 15, 2004
Posts: 110
Hi folks,

I have a typical requirement where i need to read the 2 dimentional array values.

For ex:

I have an array int[][] rand = new int[6][4];
Assume i already inserted value in all the 24 cells.
While reading i want to read all the cell values randomly.
Is there any mechanism that works like Random() for arrays.



thanks in advance.
Murali
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

How about just creating two random numbers, one between 0 and 6 and one between 0 and 4.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to read random cells from the Array of 2 dimentional.
 
Similar Threads
Drawing Canvas
Multidimensional array
array access
Are 2 arrays more costly than 1 in 2D?
Random number without dublicate