Really basic terrain generator
This won't compile:


void generator(char tree, char water, char land);
// ...
generator("T", "~", ".");



Because generator takes 3 chars, and you're giving it const char* instead.

Of course that's easy to fix, just make the params chars:

generator('T', '~', '.');




It would be better if the generator generated, instead of printing.
It's to preserve the single responsibility principle.
Like this:

char generator(char tree, char water, char land)
{
    const char tileList[] = {tree, water, land};
    int tileIndex = rand() % 3;
    return tileList[tileIndex];
}

int main()
{
    srand(time(NULL));

    while(true)
    {
        std::cout &lt;&lt; generator('T', '~', '.') &lt;&lt; " ";
    }
}




Of course the loop will never end... Are you ok with that?



Taking 3 chars as possible tiles doesn't seem too flexible. How about making it work with arbitrary number of tiles? Something like this:

char generator(const char * tiles, int len)
{
    int index = rand() % len;
    return tiles[index];
}

int main()
{
    srand(time(NULL));

    const char * tiles = "T~.";
    int len = strlen(tiles);

    while(true)
    {
        std::cout &lt;&lt; generator(tiles, len) &lt;&lt; " ";
    }
}