Generate random alphanumeric

Hi.

How to generate a random string or array of random alphanumeric characters? Obviously with the least memory used. Is there anything ready for that?

Generating a random ASCII code is not difficult but as the letters and numbers are not contiguous in their values it might be best to put all the required characters in an array of chars and generate a random index number to select one of them then put it into the target array or string. That uses more memory but allows an even distribution of letters and numbers to be generated

how can i do that?is there not anything ready that generates random alphanumeric string?

Come on, a little studying of arrays and random() can get you far.

char str[100];

void setup()
{
  Serial.begin(57600);
}

void loop()
{
  memset(str, '\0', sizeof(str));

  uint8_t cnt = 0;
  while (cnt != sizeof(str) - 1)
  {
    str[cnt] = random(0, 0x7F);
    if (str[cnt] == 0)
    {
      break;
    }
    if (isAlphaNumeric(str[cnt]) == true)
    {
      cnt++;
    }
    else
    {
      str[cnt] = '\0';
    }
    Serial.println(str);
  }
}

Study it, understand it, modify it and use it. I've specifically not added comments.

sterretje:
Come on, a little studying of arrays and random() can get you far.

char str[100];

void setup()
{
  Serial.begin(57600);
}

void loop()
{
  memset(str, '\0', sizeof(str));

uint8_t cnt = 0;
  while (cnt != sizeof(str) - 1)
  {
    str[cnt] = random(0, 0x7F);
    if (str[cnt] == 0)
    {
      break;
    }
    if (isAlphaNumeric(str[cnt]) == true)
    {
      cnt++;
    }
    else
    {
      str[cnt] = '\0';
    }
    Serial.println(str);
  }
}



Study it, understand it, modify it and use it. I've specifically not added comments.

It's fine without comments thanks!