Popular recipes by Koppula Varun Raj http://code.activestate.com/recipes/users/4181072/2012-02-27T16:58:33-08:00ActiveState Code RecipesRandom user generator (Python) 2012-02-27T16:58:33-08:00Koppula Varun Rajhttp://code.activestate.com/recipes/users/4181072/http://code.activestate.com/recipes/578055-random-user-generator/ <p style="color: grey"> Python recipe 578055 by <a href="/recipes/users/4181072/">Koppula Varun Raj</a> (<a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/pickle/">pickle</a>, <a href="/recipes/tags/python3/">python3</a>, <a href="/recipes/tags/random/">random</a>). </p> <p>I've worked on a random user generator in C a long time ago, so I thought I'd make an advanced version of it in Python(3.2). I'll have you know, I am an amateur in Python and even programming for that matter so I'd really appreciate some criticism on my code and what more can be added.</p> <p>About the program - I've added a default list of users, you can modify the list to your convenience and for data persistence, I made use of the pickle module. The random module plays the pivotal role generating the output making use of the choice method. Those along with the os module if the program is being run for the first time on a pc, it will create a data file with the default list.After some digging around, I managed to find os.getlogin() from the python library which was exactly what I was looking for (to get the computer's name making sure it can get the data file to the correct directory). I'm a little skeptical about that part, wondering whether or not it will work on every pc.</p>