Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # make lotto numbers because I demand it
- # usage pythonn lotto.py <seed (string or int)> <desired number of tickets>
- # multiple tickets will never share numbers to increase likelyhood of non-jackpot prizes
- import sys
- import random
- max_normal_numbers = 69
- max_special_numbers = 25
- allow_repeat_normals = False
- allow_repeat_specials = False
- seed = hash(sys.argv[1])
- count = int(sys.argv[2])
- random.seed(seed)
- # print "Seed: {}".format(seed)
- furb = []
- special_furb = []
- def random_do_or_loop(max_nums, furb_list):
- for moon in range(9999999):
- c = str(random.randint(1,max_nums))
- if c not in furb_list:
- return c
- print "impossibru!"
- for pick in range(count):
- normal_list = []
- special_list = []
- for normal_pick in range(5):
- normal_list.append(random_do_or_loop(max_normal_numbers, furb))
- if allow_repeat_normals is False:
- for x in normal_list:
- if x not in furb:
- furb.append(x)
- for special_pick in range(1):
- special_list.append(random_do_or_loop(max_special_numbers, special_furb))
- if allow_repeat_specials is False:
- for x in special_list:
- if x not in special_furb:
- special_furb.append(x)
- try:
- normal_str = " ".join(normal_list)
- special_str = " ".join(special_list)
- print "{} special: {}".format(normal_str, special_str)
- except TypeError:
- print "maximal numerage achieved sir!"
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement