Advertisement
Guest User

Untitled

a guest
Jan 14th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.54 KB | None | 0 0
  1. # make lotto numbers because I demand it
  2. # usage pythonn lotto.py <seed (string or int)> <desired number of tickets>
  3. # multiple tickets will never share numbers to increase likelyhood of non-jackpot prizes
  4. import sys
  5. import random
  6.  
  7. max_normal_numbers = 69
  8. max_special_numbers = 25
  9. allow_repeat_normals = False
  10. allow_repeat_specials = False
  11.  
  12. seed = hash(sys.argv[1])
  13. count = int(sys.argv[2])
  14.  
  15. random.seed(seed)
  16.  
  17. # print "Seed: {}".format(seed)
  18.  
  19. furb = []
  20. special_furb = []
  21.  
  22. def random_do_or_loop(max_nums, furb_list):
  23.     for moon in range(9999999):
  24.         c = str(random.randint(1,max_nums))
  25.         if c not in furb_list:
  26.             return c
  27.     print "impossibru!"
  28.  
  29. for pick in range(count):
  30.     normal_list = []
  31.     special_list = []
  32.     for normal_pick in range(5):
  33.         normal_list.append(random_do_or_loop(max_normal_numbers, furb))
  34.         if allow_repeat_normals is False:
  35.             for x in normal_list:
  36.                 if x not in furb:
  37.                     furb.append(x)
  38.  
  39.     for special_pick in range(1):
  40.         special_list.append(random_do_or_loop(max_special_numbers, special_furb))
  41.         if allow_repeat_specials is False:
  42.             for x in special_list:
  43.                 if x not in special_furb:
  44.                     special_furb.append(x)
  45.  
  46.     try:
  47.         normal_str  = " ".join(normal_list)
  48.         special_str = " ".join(special_list)
  49.         print "{} special: {}".format(normal_str, special_str)
  50.  
  51.     except TypeError:
  52.         print "maximal numerage achieved sir!"
  53.         break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement