Wednesday, October 12, 2011

"Pseudo Randomly" retrieve data...

When you want to crawl some websites and you want to hide yourself a little, here's a simple trick to change randomly your user-agent string.
There's a very convenient function in erlang called 'uniform' from the module 'random', you can use it by calling 'random:uniform(MaxValue)' where MaxValue is the high limit.

So if you want to generate a random value from 1 to 5 you can simple use, 'random:uniform(5)'...

Now that you know how to generate random values, here's some code that do just what's the title say:

Sticky