1d4 means that a random number between 1 and 4 inclusive will be generated.
It is the same as 1 * RandomInt(4) + 1 in escript. 2d4 would be the same as 2 * (RandomInt(4) + 1) etc. Just think of the number on the right side of the 'd' as the maximum random number that can be generated from 1 to that number and the number on the left side of the 'd' as the multiplier that will operate on the random number.
I always thought of like table top rp games, i.e. D&D. 1D6 meant a single 6 sided dice. The number you could get would be between 1 and 6. Now you might find this listed in some places also. 1D4+2, this means a single 4 sided dice (you can get between 1 and 4) plus 2. So the total would be between 3 and 7.
It does not surprise me in the least. I had to explain this to my nephew once and we very surprised at what those meant. It is funny really that most games use this method to determine the chance of something happening too.