Hello all I have an issue I'm trying to resolve regarding the use of the random number generator.

I'm trying to set the `z axis` of a point to a random number between the two nearest points.

I was getting a `divide by zero` error, which I think I figured out why happened.  

Even when I put the if statement in, it still happens sometimes.

Here is the code: (zAxis, range and min are all floats)

```
1 if (int(range) + int(min) == 0){          //this is the case where min is negative
2   zAxis = rand() % int(range);            //max is zero, which will cause error 
3   zAxis = -(zAxis / 10);
4 }
5 else{
6   zAxis = rand() % int(range) + int(min); //Getting div by 0 error here
7   zAxis = zAxis / 10;
8 }

```

I don't understand why the else clause is still executing. I'm thinking it must be how rand() works under the hood?

Can anybody explain?