Problems with generating random numbers into an array and printing them

I need help working out what I am doing wrong here. Could be that I don't understand arrays properly, but I am trying to generate 50 random numbers into an array with the intention of sorting them after. I am stuck trying to make sure this generator works, any help would be appreciated!

int randomNumber[50];
int i;

void setup() {
  
Serial.begin(9600);
randomSeed(42);   
      
}
 
void loop() {
  
  while(i =0, i < 50, i++){
  
  randomNumber[i] = random(0,256);
  
  Serial.print("The Random Number is = ");
  Serial.println(randomNumber[i]);
  delay(1000);
  }
}

Should probably say why its not working >_> It doesn't print out the Random Number generated to the console, making me think it doesn't exist.

Use a 'for' loop. Your 'while' statement wants only one boolean decision to stay or exit the loop.

Look in the reference section under Control Structures for 'while' and 'for' details.

  while(i =0, i < 50, i++){

That is NOT how a while statement is written.

You should be using a for loop, not a while statement, AND you should be using proper syntax.

Oh... Thanks for the quick replies. Fixed my problem!

You could use a while loop if you wish, although I find it nice to have everything controlling the loop on one line, which the for loop provides.

long randomNumber[50];

void setup() {
  int i = 0;
  
  Serial.begin(9600);
  randomSeed(analogRead(0));

  while (i < 50) {

    randomNumber[i] = random(0, 256);

    Serial.print("The Random Number ");
    Serial.print(i + 1);
    Serial.print(" is = ");
    Serial.println(randomNumber[i]);
    i++;
    delay(100);
  }

}

void loop() {

}