![]() Also, not all postcode districts are of the same format. Potentially you could try to create this part of the postcode randomly but you’d end up creating invalid postcodes a lot of the time. First I got together a table of postcode districts ( original list and my more programmer friendly version), which is the first half of a postcode. So I went for a more long winded approach that requires less initial data to get working. I didn’t have a complete list of postcodes and you probably won’t either, unless you’ve bought the PAF database from the Royal Mail. I guess one approach would be to have a complete list of UK postcodes and just select one at random. It may not be the best approach, but it seems to work. But I imagine there are other people who need to generate random postcodes programmatically for some reason, so I’m going to explain how my postcode generator works. I guess some people are just after a fake postcode they can plug into a website registration form, for whatever reason, and that page will do the trick nicely. But then I started wondering why anybody would want a random postcode anyway. So I built one and it’s now the most visited page on my site. Which got me thinking there must be a need for such a tool, if people were ending up at a site that didn’t have one desperately looking for it. Some time a go I noticed that the keywords ‘random postcode generator’ were landing quite a few people at my website, even though I didn’t have a random postcode generator. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |