This is a feature: for testing and validation purposes, you can have mt_rand() always produce the same pseudo-random sequence. If you don't want that, you have to seed it as Annchen describes. Incidentally, the reason you always get the exact same number is that you're only calling mt_rand() once per page load, and every time the page is reloaded your script starts over again at the top. If you were to include mt_rand() in a loop, then you would see a series of numbers, but again, it would be the exact same series each time unless you seeded it.