SHARE
TWEET

Untitled

a guest May 13th, 2017 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2.  
  3. def rand_die(n):
  4.     s = n*(n+1)/2
  5.     while 1:
  6.         A = [random.randrange(n)+1 for x in xrange(n-1)]
  7.         diff = s - sum(A)
  8.         if diff<=0 or diff>n:
  9.             continue
  10.         A.append(diff)
  11.         return A
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top