Possible permutations of a grid I hope this is the correct place to post this, as I don’t study maths. But I do need help calculating the possible permutations of a grid based game I’m currently programming. This isn’t to help out with the game logic, but rather to help me understand how many different combinations of each puzzle I can get by randomising the placement of the tiles. 

I think that to someone with a good understanding of maths, this should be a pretty basic problem to solve. I would give it a shot myself, but I didn’t study further maths and I really want a correct answer/algorithm. 

Okay so this is the scenario: 

I have a 5x5 grid of coloured tiles. There are 5 different colours of tiles. By default, the tiles are ordered into rows of 5. My question is, if every tile can go to any position in the 5x5 grid, how many possible permutations of the grid are there? (also taking into account that tiles of the same colour count as the same tile, so 'red tile A’ is exactly the same as ‘red tile B’ as far as the game mechanics are concerned)

It would be useful to know what you think the permutations figure is for this specific grid but also the calculation you used to arrive at that answer. The reason for this is that the size of the grid may change in the future and I’d like to be able to use the same algorithm to calculate its permutations. It's also likely that I will have other layouts which aren't arranged into rows, and may have different quantities of each block, so if anyone could point me in the right direction with this, it would be greatly appreciated!

Thanks for any advice!!

Below is an example screenshot of what I mean, you can ignore the numbers as they are just for debugging purposes.
If the tiles were distinguishable, we could permute them in $25! $ ways, since for the first tile there would be $25 $ places, for the second one $24 $ etc... But now we can still interchange tiles of a given color with themselves (and leave the permutation "the same"). For instance the red tiles can be permuted between eachother in $5!$ ways. Therefore the final answer should be (divide by $5!$ for each color):

$$\frac {25!}{5! 5! 5! 5! 5!}=\frac{(5^2)!}{(5!)^5}=623360743125120$$

Usind the same reasoning, for an $n \times n$ grid we get:

$$\frac {(n^2)!}{(n!)^n}$$

Now note that the total number of permutations has nothing to do with the grid being a square, so we can generalise even further, to a grid with $k$ tiles and number of tiles per colour $n_1,\cdots,n_m$ (with $n_1+\cdots+n_m=k$). Then we get:

$$\frac{k!}{n_1!*\cdots *n_m!}$$
different permutations.
Let's start with a blank grid of 25 possible places. At this point there are twenty five possible permutations of any given block. We'll say that this starting point is block 1, after this we have to fill up twenty four more so multiply twenty five by twenty four and get six hundred. This means that there is a one in six hundred chance that a randomly generated sequence would have put this as the space filled. Then multiply six hundred by twenty three because there are twenty three possible places left. Hopefully you understand the process  so just repeat this until you finish filling up the grid and take the chance that you got that sequence and that is how many possible permutations there are of that grid with one by one blocks.
I see that uncountable has already answered but I thought it might be useful.