All pastes #114548 Raw Edit

Mine

public text v1 · immutable
·published 2006-08-04 02:55 UTC
rendered paste body
#!/usr/bin/python

# lotto picker by manny juan  (juanm@wellsfargo.com or manny@bdt.com)

from random import randint

def pick_lotto():

  maxm=55; maxj=5; j = final_run = roll = 0; lastn = [5,10,17,24,43,31]
#  maxm=7; maxj=5; j = final_run = roll = 0; lastn = [1,2,3,4,5,1]

  while j <= roll:
    v=[]
    m=maxm
    # create all numbers from 0 to m
    r=range(m+1)
    for k in range(maxj):
      # get ith number from r...
      i=randint(1,m)
      n=r[i]
      # move last elem to hole...
      r[i]=r[m]
      m -= 1
      # and append to the result
      v.append(n)
    if not final_run:
      v.sort()
      v.append(randint(1,42))
      if v != lastn:
        j += 1; roll += 1
      else:
        j = 0; final_run = 1
    else:
      j += 1; x = randint(1,42)
  v.sort()
  v.append(x)
  print v, j - 1, roll, "146,107,961 Win"

  return

# immediate-mode commands, for drag-and-drop or execfile() execution
if __name__ == '__main__':
        for i in range(1):
                pick_lotto()
else:
        print "Module lotto imported."
        print "To run, type: lotto.run()"
        print "To reload after changes to the source, type: reload(lotto)"
# end of lotto.py