# Grid with random colors

**URL:** <https://discourse.processing.org/t/grid-with-random-colors/36469>\
**Category:** Coding Questions\
**Created:** [April 19, 2022, 11:45pm UTC](https://discourse.processing.org/t/grid-with-random-colors/36469 "2022-04-19T23:45:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![humano](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@humano](https://discourse.processing.org/u/humano)\
**Post date:** [April 19, 2022, 11:45pm UTC](https://discourse.processing.org/t/grid-with-random-colors/36469/1 "2022-04-19T23:45:05Z")

</div>

Hi there,

I am trying to make a grid with random colors on every cell, but I only can change the color of every column and I don’t know why. Could you please help me?

```auto
size(1000,1000);
  stroke(1);
     
  for(int x=0; x<1000; x=x+100) {
    for(int y=0; y<1000; y=y+100)
    rect(x,y,100,100);
    fill(random(256),random(256),random(256)); 

  }

```

---

<div class="post-metadata">

**Author:** ![Divitiacus](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@Divitiacus](https://discourse.processing.org/u/Divitiacus)\
**Post date:** [April 20, 2022, 12:58am UTC](https://discourse.processing.org/t/grid-with-random-colors/36469/2 "2022-04-20T00:58:29Z")

</div>

There are no curly braces after the second if condition check, therefore there is only action on the x.

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [April 20, 2022, 9:40am UTC](https://discourse.processing.org/t/grid-with-random-colors/36469/3 "2022-04-20T09:40:13Z")

</div>

Hello,

Nested loops:

[https://processing.org/reference/for.html](https://processing.org/reference/for.html) \< See last example

[![](https://img.youtube.com/vi/H7frvcAHXps/hqdefault.jpg "6.6: Nested Loops - Processing Tutorial") ](https://www.youtube.com/watch?v=H7frvcAHXps)

`:)`
