Fix random username generation to support Python 3