Hi there I was wondering if anyone could give me a clue as to what I am doing wrong with this code, I think I may be declaring the Random method in the wrong place? I am trying to apply one of R,G,B from colourArray at random to one of the points in the array myBigArray...
The compiler returns: '.class' expected. int x = Math.random() * char colourArray.Length(); and the same for the related line myBigArray [wC] [dC] [hC] = char colourArray[x];
If anyone has any suggestions or ideas, that would be great because I've hit a brick wall! Cheers people.
You've been around the ranch long enough to know that we have a policy on screen names. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.
As to the problem, what is the "char" doing in those two lines? Also, arrays don't have a method called "Length()", they have a property called "length" (no parentheses und lowercase). [ November 02, 2006: Message edited by: Ulf Dittmer ]
Hi there Ulf, apologies for that, all changed now. As for the parathenses that's just me being a twit, thanks for pointing that one out! The char is because, the array created prior to that is of type char, and therefore I thought any method declaring that array must also be of type char? Am I wrong? Thank you for your help Ulf, much appreciated. [ November 02, 2006: Message edited by: Hugh Mclaughlin ]
The char is because, the array created prior to that is of type char, and therefore I thought any method declaring that array must also be of type char? Am I wrong?
I'm not making sense of this. Are you attempting to cast the array to something? What happens if you simply remove the "char"? I'm not sure if you can assign a 1D array to a 3D array, like you are doing in the second problematic statement, though. You may have to copy it one element at a time.
The array myBigArray is creating a 3D cube of dimensions 8x8x8.
Then with colourArray I am trying to assign every single point in that array one of R,G,B completely randomly. So essentially assigning a member of colourArray (1D) to myBigArray (3D), is that not possible the way I am going about it?
Dear Ulf, I now see your point about those chars, that was entirely incorrect, the new lines are below, but now the compiler returns the " ']' expected " error on the line where I declare my 1D array...