|
-
Apr 8th, 2002, 10:38 PM
#1
Thread Starter
Lively Member
random number generator problem
I am doing a program where I build a two-dimensional array and then populate it with elements by using a random number generator. It is supposed to have random numbers between 1 and 100. I keep getting a compiler error saying that I have the wrong number of dimensions. Is this something about the way I set up the array or is it the code for the random number generator? This is what I have so far:
Dim x(1 To 5, 1 To 10) As Single
Dim n As Long, i As Long
For i = 1 To 5
x(i) = Int(Rnd * 100) + 1
Next i
For i = 1 To 5
Print i, x(i)
Next i
For n = 1 To 10
x(n) = Int(Rnd * 100) + 1
Next n
For n = 1 To 10
Print n, x(n)
Next n
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|