So I'm writing a c++ version of the game battleship. I am currently trying to get random placement for my ships on the board, it works sometimes but other times it crashes. I think it's accessing memory from outside my array but I'm not sure. Any advice would be appreciated. Below is my function for placing the battleship. The array it's being entered into is [10][10]