argument handling, random number generation, and list handling functions