C++ breaks out of the loop when filling the array

So basically I am trying to create a loop that fills a matrix with random numbers. I need to make it so every column has a different range, unique to it.

    //Variables
    int lsx = 3;
    int lsy = 10;
    int lust[lsy][lsx];
    int i = 0;
    int l = 0;
    int shpp = 7;
    //List setup
    for (i = 0; i < lsy; i++)
    {
        for (l = 0; l < lsx; l++)
        {
            lust[i][l] = 0;
        }
    }
    while (true)
    {
        //List generator
        for (i = 0; i < lsy; i++)
        {
            for (l = 0; l < lsx; l++)
            {
                //Column 1
                if (i == 0)
                {
                    lust[i][l] = rand() % flx;
                    cout << lust[i][l] << 'n';
                }
                //Column 2
                if (i == 1)
                {
                    lust[i][l] = rand() % fly;
                    cout << lust[i][l] << 'n';
                }
                //Column 3
                if (i == 2)
                {
                    lust[i][l] = rand() % shpp;
                    cout << lust[i][l] << 'n';
                }
            }
            cout << "Endline reached! n n";
        }
        for (i = 0; i < lsy; i++)
        {
            for (l = 0; l < lsx; l++)
            {
                cout << lust[i][l] << " ";
            }
            cout << "n";
        }
    }   
}

This only generates 3 lines. Does anyone have any ideas on why this could happen?
I tried changing some stuff around but only got weirder results that wouldn’t fill the array in completely eitherThis is what the program displays when I try and run it

Source: Windows Questions C++

LEAVE A COMMENT