vendredi 2 octobre 2015

Random positioning of pawns on chessboard

I want to (pseudo) randomly position a number points on a grid. Think of it as 10 x 10 chessboard with 100 squares) And think of these points as pawns on the chessboard, that occupy one square each. What I want is for the pawns to be "evenly" distributed over the board. The middle-square method is fine for generating the random numbers.

My problem that is that if I store the grid squares as list, and draw them from top left to bottom right, then square 9 is not next to 10, it's next to 0 & 20. What's the best way around this?




Aucun commentaire:

Enregistrer un commentaire