Hi can someone help me with this question please?

  1. In "setup" Create an array of 1000 random integers between 0 and 100. Also, in "setup" declare an array of bins or counters to find out how many integers fall into one of the 10 "bins" 0-9, 10-19, 20 -29, 30-39,.................90-99.

You now pass the two arrays to a function called "counter" which will count how many elements fall into each of the bins. When you return to "setup" print out the numbers in each bin.

Sorry I didn't know

here is what i came up with, but i don't know where i went wrong

void  setup( ){
  //an array  of 1000 random integers between 0  and 100
  int i;
  float randNum[];
  float sum;
  int howmany =1000;
  randNum = new float[howmany];

}

I have a similar problem. I declared my initial array (1000 random integers), but cannot figure out how to sort them.

void setup ( ) {
  size ( 500, 500);
  background (5);

  //make array of 1000 random integers
  int [ ] Array1000 = new int[1000];

  int n = 0;
  while (n < 1000) {
    Array1000[n] = int(random(0, 100));
    n = (n + 1);
  }

Here is an example of how to do the random number in Java (integer). From there, you should try to iterate through the array and categorize each value into your own bins (100 of them).

This article has been dead for over six months. Start a new discussion instead.