For a game I'm writing I need to **find an integer value for the distance between two sets of coordinates**. It's a **2D array** that holds the different maps. (Like the original zelda). The further you go from the **center (5,5)** the higher the number should be since the difficulty of enemies increases. Ideally it should be **between 0 and 14**. The **array is 11x11**.

Now, I tried to use the **pythagoras** formula that I remember from highschool, but it's spewing out **overflow numbers**. I can't figure out why.

```
        srand(rand());
        int distance=sqrt(pow((5-worldx), 2)-pow((5-worldy), 2));
        if(distance<0) //alternative to abs()
        {
            distance+=(distance * 2);
        }
        if(distance>13)
        {
            distance=13;
        }

        int rnd=rand()%(distance+1);

        Monster testmonster = monsters[rnd];

```