We are about to switch to a new forum software. Until then we have removed the registration on this forum.
int drk;
int lgt;
int normal;
int changer;
int changeg;
int changeb;
float r=random(0,255);
float g=random(0,255);
float b=random(0,255);
float[] [] [] arr = new float[r][g][b];
Answers
It shows an error at the array saying "cannot convert from float to int"
Yes, you cannot have 2.3256 entries in an array, so r, g and b should be int, and you should initialize them with
int(random(255));
So change it to int r=int(random(255));
@PhiLho thanks
There's already a built in color type (actually an integer) - just use that.
But having seen the whole question, the whole approach is wrong. You don't need an array at all. (And please don't post multiple questions, it just splits up information and creates work)
http://forum.processing.org/two/discussion/10364/getting-a-random-color-checkerboard-with-random-fill
here comes a checker board....
regarding 3D array there is a big misunderstanding...
you want to store three values rgb, but you can just store the data type color
even when you want to store 3 values, you don't need a 3D array - you just would (!) need three parallel 1D arrays.
I'll explain.
A 1D array is a list of values. Those values can be color or a class. You need one index to get a value.
A 2D value is a grid (like a chess board). You still only get one value (not two!), the value being the cell of the grid. But you now need 2 indexes to get the cell position / value.
A 3D value is a stack of grids (like 8 chess board on top of each other). You still only get one value (not three!), the value being the cell of the grid. But you now need 3 indexes to get the cell position / value: row, column and etage (floor in the stack).
Since you want a grid you can use a 2D array of color:
color[][] colors = new color[][];
my example comes without that.
The three parallel 1D arrays I spoke about; instead of a class with three values you can use parallel arrays for each value. But as said it doesn't apply here since you store only one value (color).
;-)