i want to generate a series of random numbers like
00101
01011
01111
01010
11101
it is a 5*5 matrix and is random every time upon execution
my code is:-
Private Sub Command1_Click( )
Call Randomize
Dim x As Integer, y As Integer, z As Integer, t As Integer, s As Integer
Dim i As Integer, k As Integer
x = 0 + Int(2 * Rnd())
y = 0 + Int(2 * Rnd())
z = 0 + Int(2 * Rnd())
t = 0 + Int(2 * Rnd())
s = 0 + Int(2 * Rnd())
Print x, y, z, t, s
End Sub
but i have to click on command button each time to generate a random 0's and 1's and i want to print random 5*5 matrix in a single click as said above but in this code when i m clicking the command button i m getting a 1*5 random matrix and i have to click again and again.....can i use goto control and send the cursor to initialize again and again and print till i get a 5*5 matrix or use for loop.. but i have tried everything and it isn't working....plea se help me get 5*5 random matrix of 0's and 1's.......
1 2025
Use a nested for loop structure... -
Dim OuterForLoopCounter As Integer, InnerForLoopCounter As Integer
-
Dim Result As Integer, MyMatrix(1 To 5, 1 To 5) As Integer
-
For OuterForLoopCounter = 1 To 5
-
For InnerForLoopCounter = 1 To 5
-
Result = Int(2 * Rnd)
-
MyMatrix(OuterForLoopCounter, InnerForLoopCounter) = Result
-
Next InnerForLoopCounter
-
Next OuterForLoopCounter
-
Good Luck
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Acacia |
last post by:
How would you generate a random number in C++?
|
by: Zeya |
last post by:
I need to randomly generate a 16 digit hex number in C# code.
How can I do this?
Thanks.
|
by: amitnanda |
last post by:
Hi Guys,
I have a matrix multiplication program in C that multiplies two
matrices.
When their size is 3*3 or 800*800, the program runs fine. But above
that size, I get a "segmentation fault".
I need this huge size as part of my assignment.
|
by: comp.lang.php |
last post by:
/**
* Generate the random security image
*
* @access public
* @param $willUseFilePath (default false) boolean to determine if you
will be using a file path
* @param mixed $filePath (optional) file path to store image resource
object contents
* @see actual_path
*/
|
by: =?UTF-8?B?TWFydGluIFDDtnBwaW5n?= |
last post by:
Hello,
I´m using a very large 2-dimensional double matrix (45.000x45.000)
in my program.
At the initialization of the matrix:
double matrix = new double I am getting an out of memory
error.
| |
by: robert maas, see http://tinyurl.com/uh3t |
last post by:
I'm working on examples of programming in several languages, all
(except PHP) running under CGI so that I can show both the source
files and the actually running of the examples online. The first
set of examples, after decoding the HTML FORM contents, merely
verifies the text within a field to make sure it is a valid
representation of an...
|
by: jjmillertime |
last post by:
I'm new so i apologize if this is in the wrong spot. I'm also new to
programming in C and i've been searching for quite a while on how to
create a program using C that will generate two random numbers,
multiply them, and ask you for the result. It also needs to have four
responses for both right and wrong answers and should print them...
|
by: pereges |
last post by:
I need to generate two uniform random numbers between 0 and 1 in C ?
How to do it ?
I looked into rand function where you need to #define RAND_MAX as 1
but will this rand function give me uniformly distributed and unique
numbers ?
|
by: Sozos |
last post by:
Hi guys. I have a problem with writing the base case for the following matrix multiplication function I have implemented. Please help.
#define index(i,j,power) (((i)<<(power))+(j))
void recMultiply(int i, int j, float a, int k, int l, float b, int x, int y, float c, int s);
int i, j, k, s, matrixsize, blocksize, jj, kk, power, bsize;...
|
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. ...
|
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...
| |
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |