pinocchio

rand7 w/ rand5

Mar 28th, 2012
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.18 KB | None | 0 0
  1. def rand7 ():
  2.     v = 25 * (rand5 () - 1) + \
  3.         5 * (rand5 () - 1) + \
  4.         rand5 () - 1
  5.  
  6.     if v > 118:
  7.         return rand7 ()
  8.     else:
  9.         return (v % 7) + 1
Advertisement
Add Comment
Please, Sign In to add comment