Building Random People

Posted On 2017-12-21 by VB6Boy
Tags: VB6 Miscellaneous VB6 Files and I/O VB6 String Handling Windows
Views: 324

Title Uploaded Size 12/21/2017 7:28:49 AM 1,030,995

Yes, building people. This program, meant to demonstrate the use of a few different methods, builds random person data (Address, phone, etc).

I didn't build this for someone to build false identities for nefarious purposes, although it could probably be used for that. Nay, I built this to demonstrate the use of a few different concepts in Visual Basic 6 (VB6):

  • Reading large text files from disk
  • Storing data in arrays
  • Choosing random records from an array
  • String concatenation
  • Parsing multi-field array elements

Some of these items might seem like basic knowledge to some folks, but remember, there is a starting point for everyone, and there are people out there that might be trying to learn this stuff.

Details, details

The program does one thing, and one thing only: generate fake people. It simply creates four pieces of information:

  • Name
  • Gender
  • Phone Number
  • Address

PersonBuilder Screenshot

PersonBuilder has been built in such a way that the generated data "matches". This means it won't assign a female name to a male, or vice versa. Also, the area code matches the address information.

To build this data, I've used six files, which I have included in the archive. The file information is shown below.

Filename Record Count
PB-Surnames.txt 88,798
PB-Male.txt 1,219
PB-Female.txt 4,275
PB-Locations.txt 42,009
PB-Streets.txt 96
PB-StreetTypes.txt 6
Total Records: 136,403

One interesting thing to note is the structure of the PB-Locations file: The file is tab-delimited. This allows us to store related data on a single line of the file, given that we can extract the data from the line. While there may only be 42,009 records in the file, there are 336,072 pieces of extractable data. Cool, eh? Further, it allows for easy import into a database or spreadsheet, for use in other applications.

While perusing this code, you might notice that I've used the currency variable type on a few of the arrays and counters. I could have used the Long variable type, but I wanted to be able to go beyond the limitations of the type.

Long integers in VB6 are limited to 2,147,483,468, both to the right and left of the zero. The currency data type increases that by a factor of 10,000, to 922,337,000,000,000 items. I don't think I'll ever need 922 trillion names, but you never know. ;) The tradeoff is that the currency datatype uses 8 bytes of memory, compared to 4 bytes used by a long integer data type.

Anyway, I hope someone finds this useful. As always, hit me up in comments below, or in the forums, if you have any questions comments about this code.

About the Author

has posted a total of 101 articles.

Comments On This Post

No comments on this post yet!

Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.

Your IP address is:

Before you can post, you need to prove you are human. If you log in, this test goes away.

Code Links