Minesweeper?

I wanna make a game that has the same basic behaviours as the classic minesweeper game.
The only problem is when I randomly generate the bombs I can't figure out how to pick how many show up.. I need to be able to:
- Make Grid
- Randomly generate a set number of bombs
- Have the bombs "evenly" spread out across the grid
the best example is this demo: http://gamesalad.com/game/play/301
But I want the bombs randomly and evenly spread out across the grid. My bombs always clump at the top of the grid. =/
Any help would be appreciated.
The only problem is when I randomly generate the bombs I can't figure out how to pick how many show up.. I need to be able to:
- Make Grid
- Randomly generate a set number of bombs
- Have the bombs "evenly" spread out across the grid
the best example is this demo: http://gamesalad.com/game/play/301
But I want the bombs randomly and evenly spread out across the grid. My bombs always clump at the top of the grid. =/
Any help would be appreciated.