# New to Processing, I need HELP!

**URL:** https://discourse.processing.org/t/new-to-processing-i-need-help/16116
**Category:** Coding Questions
**Created:** [December 4, 2019, 2:44pm UTC](https://discourse.processing.org/t/new-to-processing-i-need-help/16116 "2019-12-04T14:44:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ihatearrays](https://avatars.discourse-cdn.com/v4/letter/i/b9e5f3/32.png) [@ihatearrays](https://discourse.processing.org/u/ihatearrays)
#### Post date: [December 4, 2019, 2:44pm UTC](https://discourse.processing.org/t/new-to-processing-i-need-help/16116/1 "2019-12-04T14:44:36Z")

</div>

Hi, I’m new to Processing, I’m making a 3x3 grid game that makes users mousehover over to a target square that is one of the 9 squares. I’m trying to create a function called getNextSquare that picks a random number between 1 and 9 to be the target that that loops again if it picks the number(square) previously clicked by the user to pick a number (square) that wasn’t picked before.  
Any help would be vastly appreciated. Here’s my code.

```auto
int nextSquare = 0;
void setup() {
size(400,400);
nextSquare = 0;
}

void getNextSquare() {
for (int nextSquare = 0; nextSquare < 10; nextSquare++) {
  float r = random(1, 9);
  println(r);
}
}

```

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [December 4, 2019, 3:30pm UTC](https://discourse.processing.org/t/new-to-processing-i-need-help/16116/2 "2019-12-04T15:30:30Z")

</div>

> [@ihatearrays](#):
>
> float r = random(1, 9);  
> println®;

Since your squares are numbered 0-8 then try

```auto
int r = (int) random(0, 9);
println( r );

```

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [December 4, 2019, 3:38pm UTC](https://discourse.processing.org/t/new-to-processing-i-need-help/16116/3 "2019-12-04T15:38:21Z")

</div>

You definitvly need a draw function that displays the grid

And you need an array to store which cells have been clicked

getNextSquare should check against this array to choose only unclicked cells
