Facebook | Onsite | Randomly generate mines on a grid

You are given a m*n grid. You are asked to generate k mines on this grid randomly. Each cell should have equal probability of k / m*n of being chosen.

Comments (31)