10 digit random number generator work with uin8_t

I have taken out the random() function for the moment as i was trying different methods here is my code which is working:
Tx :

void loop()
{
uint8_t data[] = ("TEXT");
nrf24.send(data, sizeof(data));
nrf24.waitPacketSent();
Serial.println((char*)data);
}

Rx :

void loop()
{
uint8_t data[RH_NRF24_MAX_MESSAGE_LEN];
uint8_t len3 = sizeof(data);
if (nrf24.waitAvailableTimeout(200))
{
    if (nrf24.recv(data, &len3))
    {
        Serial.println((char*)data);
        Serial.println("");
     }
}
}

The above codes work and "TEXT" is sent without issues.
I would like to generate a random 6-10 digit number which would replace "TEXT".
I have tried using different data types like "long" along with "random()" but the data gets corrupted.