# Perplexity Boolean array

**URL:** <https://discourse.processing.org/t/perplexity-boolean-array/18594>\
**Category:** Coding Questions\
**Created:** [March 11, 2020, 11:15am UTC](https://discourse.processing.org/t/perplexity-boolean-array/18594 "2020-03-11T11:15:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marika20](https://avatars.discourse-cdn.com/v4/letter/m/d26b3c/32.png) [@marika20](https://discourse.processing.org/u/marika20)\
**Post date:** [March 11, 2020, 11:15am UTC](https://discourse.processing.org/t/perplexity-boolean-array/18594/1 "2020-03-11T11:15:55Z")

</div>

Hello everyone!  
I would like to ask for a hand: with this code that I wrote required uscrimi you must “true or false” values based on the randomNum values that I have assigned; instead I get only “false” values.  
Also I should when i = 0 assign the container value [i] ie container [0] which then becomes 1 then container [1] etc.  
I don’t understand what is missing ☹

If someone dares me a tip I would be grateful!  
Thank you

Marika

```auto
float randomNum;
boolean[] contenitore = new boolean [5];

void setup() {
  size(400, 400);
  background(127);
  frameRate(1);
  println();
}

void draw() {
  randomNum = random(100);

  for (int i = 0; i < i; i = 1) {
    randomNum = 100;
    if (randomNum < 50) {
      contenitore [i] = true;
    } else {
      contenitore[i] = false;
      i = 1;
    }
    randomNum = 80;
    if (randomNum < 50) {
      contenitore [i] = true;
    } else {
      contenitore[i] = false;
      i = 2;
    }
    randomNum = 60;
    if (randomNum < 50) {
      contenitore [i] = true;
    } else {
      contenitore[i] = false;
      i = 3;
    }
    randomNum = 40;
    if (randomNum < 50) {
      contenitore [i] = true;
    } else {
      contenitore[i] = false;
      i = 4;
    }
    randomNum = 20;
    if (randomNum < 50) {
      contenitore [i] = true;
    } else {
      contenitore[i] = false;
      i = 5;
    }
  }

  println(contenitore);
}

```

---

<div class="post-metadata">

**Author:** ![matheplica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/matheplica/32/21035_2.png) [@matheplica](https://discourse.processing.org/u/matheplica)\
**Post date:** [March 11, 2020, 2:02pm UTC](https://discourse.processing.org/t/perplexity-boolean-array/18594/2 "2020-03-11T14:02:35Z")

</div>

I just change this for me it’s enough like that

```auto
void draw() {
    for (int i = 0; i <contenitore.length; i++) {
        randomNum = random(100);
        if (randomNum < 50) contenitore [i] = true;
        else contenitore[i] = false;
    }
    println(contenitore);
}

```

---

<div class="post-metadata">

**Author:** ![marika20](https://avatars.discourse-cdn.com/v4/letter/m/d26b3c/32.png) [@marika20](https://discourse.processing.org/u/marika20)\
**Post date:** [March 11, 2020, 2:38pm UTC](https://discourse.processing.org/t/perplexity-boolean-array/18594/3 "2020-03-11T14:38:39Z")

</div>

Thanks a lot for your help, very kind! 🥰
