ARRAY PROGRAMMING

HI..
I HAVE A QUERY ABOUT ARRAY GENERATION:

I have an array named randomval which stores 30 random generated values.
I have an array seat[j] which has 6 numbers stored in it.
I want to print a random number for every j . For the same j ,random numbers should not repeat.
i.e if j=201, i=0 to 30 should print in it.
if j=202 , i-0 to 30 should print in it.
but j wont go in sequence ,
it will be randomly generated i.e after j=201, it might be j=206 or j=207
can someone please give a solution to this.
the basic code I have is as follows:
int randomVals[30];
void setup() {

  • int temp;*

  • int passCounter = 0;*

  • //int elementsFilled = 0;*

  • //randomSeed(analogRead(0)); // Seed generator...*

  • Serial.begin(9600);*

  • while (true) {*

  • temp = random(0, 30);*

  • if (randomVals[temp] == 0) { // If this number has not been generated yet...*

  • randomVals[temp] = passCounter++; // ...write its value here.*

  • //Serial.println(passCounter);*

  • }*

  • if (passCounter > 30) { // If we've filled in all elements, leave...*

  • break;*

  • }*

  • }*

}
void loop()
{

  • for (int i = 0; i < 30; i++)*
    _ Serial.println(randomVals*)[/color];_
    _
    }*_

Do you want to learn how to do it or do you just want a working code?

How does the code know if it has already been to that index? Perhaps you need another array.

Your code does not contain a 'seat' array. Maybe you can rephrase your question as I don't have any idea what you want.

Please don't shout (all capitals); it's considered impolite.

Please place your code between code tags; [code] your code here [/code] will result in

 your code here

You seem to be mixing up the numbers held in an array with the index numbers of the array.

This

randomVals[temp] = passCounter++;  // ...write its value here.

does not put a random value into the array, It puts a known value into a random location

and in your description

I have an array seat[j] which has 6 numbers stored in it.
....
i.e if j=201, i=0 to 30 should print in it.

j can never have a value of 201. Its valid range is 0 to 5

...R