- import random
- import string
- def gen_random_server_port():
- """
- Generates a valid random first and last character for a bots hostname
- and computes a port from these two characters.
- """
- firstLetter = random.choice(string.ascii_letters);
- lastLetter = random.choice(string.ascii_letters + string.digits);
- return (ord(firstLetter) * ord(lastLetter));
|