Random You Say! Oh, Really…
I don’t know how many times I’ve stumbled across PHP code for generating random strings and numbers that aren’t random at all.
Take this example that I just found for instance:
<?php ... $RandomStr = md5(microtime()); ... ?>
Statement from the author: “…[md5 (microtime ())] use to generate the random string…”. [source]
So very wrong… I can predict the time and hence I can predict the outcome of that piece of code. That’s not random.
If you have a look at the website where I found this you can of course argue that the above snippet would be sufficient and maybe it is enough to fool most bots but it’s still not random and that’s my point.
If you wonder about the definition of Random I think wikipedia is doing quite a good job at it.










