Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multi Dimensional Arrays and nextBoolean

 
Julian Bailey
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to solve a problem and have come to the stage of tearing my hair out! Basically I want to create a java program that produces a console display like so.
x0xx0
0x00x
0xxx0
xxx00
0000x
The rows and columns must be randomly filled.
I believe that one needs to use a two dimensional array to achieve this problem and have come across/ modified the following code out of two java problems.
THIS PROGRAM BASICALLY PRINTS OUT AN ARRAY OF 5 x 5 numbers.

THE NEXT PROGRAM I CAME ACROSS USES nextBoolean TO ASSIGN RANDOM LETTERS TO A GRID AND THEN REPEATS THE RANDOM GRID A NUMBER OF TIMES.

The RandomValuesTrue.java program is nearly what I want, regrettably it only prints out one column to the console.
Please, please, please can someone help me two work out how to generate a random grid using the code I've created in RandomValuesTrue and stop me from becoming prematurely bald?
Thanks for your help.
Julain
[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ April 07, 2004: Message edited by: Dirk Schreckmann ]
 
Eddie Vanda
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another way, maybe.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic