Random() php/javascript - why is this happening?

This isn't a problem as such (yet), but I am curious if anyone can explain why this happens.I created a simple 'find 12 objects avoid 1 trap' game in a 8x8 grid (so 64 possible options). Players click the squares in the grid to find the objects, and if they find the trap 'game over'.The objects and trap are placed randomly with php at the start of the game. Gameplay is handled with javascript.When I remove the 1 trap from the game it allows you to play right up to the last 1-2 squares everytime (ie. nearly all 64 squares are revealed). This doesn't make sense to me? Surely if the objects and trap are placed with php when the page loads the game should be completely random. I know random isn't always random with programming, but it's as if the game isn't setting the objects until after the user has clicked the squares. How is this possible if the game loads with php? Does anyone know?
 
Top