473,788 Members | 2,837 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with Arrays and Random

6 New Member
Hi, I am a beginner in JAVA language...
I am making a simple sudoku game (in notepad -I have to use only notepad).
I have my sudoku tables stored in 2d arrays e.g sudoku1[9][9].
Lets say I have 5 2d-arrays, sudoku1....sudo ku5, and I want a random one to be chosen... how do I do that.
I know I have to use class Random, but how do I make it in this case (i.e 2d arrays)??

also
this is how u put values in a 2d array...
int [][] example2d=
{
{0, 3, 2},
{0, 5, 8},
};
how can u put values in a 3d array??
int [][][] example3d=
???????
May 3 '07
10 2018
Ganon11
3,652 Recognized Expert Specialist
But if I put them in a text file will I be able to retrieve a random table (pull randomly a whole 2d array).
I mean now that I have put them in a 3d one I can choose a random one.
Expand|Select|Wrap|Line Numbers
  1. my3DArray[ran.nextInt(3)][][]
Yes. At the start of your program, you can read in the sudoku puzzles into the 3d array, and can still use the above code to randomly select a puzzle.

how can the "user" store (meaning to store while the program is runned)?
Expand|Select|Wrap|Line Numbers
  1.  n=sc.nextInt()
How can that value stay permanently?
I'm not exactly sure what you mean by this...could you elaborate further as to what you're trying to accomplish?
May 4 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

10
2506
by: Virus | last post by:
Ok well what I am trying to do is have 1.) the background color to change randomly with 5 different colors.(change on page load) 2,) 10 different quotes randomly fadeing in and out in random spots on the webpage. with a delay timer on them, so they keep changing as the page is open. Not random each time the page is loaded. If anyone can help it would be greatly appreaciated, I have tried many of
20
2689
by: titi | last post by:
Question The road and traffic authority for a small country currently uses a system to store information about all 'currently' licensed drivers. A licensed driver has the following info stored about them in a record; 1. Given name(s) of the license holder.(not more than 128 char (may have spaces)). 2. Surname of the license holder.(Not more then 128 same like above).
3
1927
by: bb91915 | last post by:
I am taking a beginners class in C and am attempting to write code for extra problems my instructor gave us. These are not for grade and are only used solely for practice. I have a hard time taking pseudocode and turning it into code. Since I am in a beginners class, we have only learned so much to date, so what I am presenting will be really rough, so please pardon my ignorance. Here are my instructions, with my code to follow: ...
1
4152
by: Michael Fitzpatrick | last post by:
Transferring arrays from C DLL's to VB.Net I have a DLL written in C. This DLL reads a text file and creates a several very large arrays, 500,000 points and even larger. I would like the get the data in VB.Net so that I can plot it. Presently I am creating an equally sized array in VB and copying the data from the DLL's array into the VB array. There must be a better way. I looked into using a SAFEARRAY but it looks to me that VB.Net...
6
3672
by: MC | last post by:
Good Morning Anyone know any good lessons online about Arrays in vb.net. I am a hobbiest and stuggling to understand Arrays. Let me explain briefly what I want to do. I am writing a Poker Solutions Program purely for my oen fun and want to shuffle a deck of cards. now the easiest way, i think, is to make an Array that looks like this:
5
1844
by: aaragon | last post by:
Hello everybody, I appreciate your taking the time to take a look at this example. I need some help to start the design of an application. To that purpose I'm using policy-based design. The idea is to have a Class that stores elements of Class2 in different ways (arrays in stack memory, arrays in heap memory, using the std::vector and so on). I would like the user to customize the creation of a class with Class2 and StoragePolicy like...
36
1897
Bigj0410
by: Bigj0410 | last post by:
i've been trying to figure out these questions and i can't seem to understand them...can anyone help? 1)Write a full program in C++ that creates the two-dimensional randomArray array with 10 rows and 10 columns, and fills it with random numbers respectively: the first row with random number in range [1, 100), the second row with random number in range [100, 200), …, the 10th row with random number in range [900, 1000), The program then...
16
2043
by: wokeup2sleep | last post by:
im a beginner at comp science, and my prof is using python, which is totally new tom me i had a few questions with the program im writing, im having a few problems. brief summary i have to do a project where there are nine boxes filled with number 1-8, and 1 space is empty, the game needs to be scrambled, also all the moves need to be saved. the game can be paused anytime during thegame. the object is to move the numbers into the black spot...
4
7332
by: Leroymetzker | last post by:
//My card class import java.util.Arrays; import java.util.Random; public class Card { //Attributes private int suit; private int value;
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10112
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4070
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3675
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.