I think that you need to change the logic. In your code, only the direction is getting chosen randomly. The element should also be chosen randomly. As well as in one iteration after moving a '1', it will be replaced with zero. So the 1's will soon spread across the matrix in few iterations. So, it will be a good idea to think along the following line:
1. find the coordinates of non-zero elements in the matrix.
2. pick one of the co-ordinate randomly from above set.
3. Choose a random direction and move in that direction.
Hope this helps.