Advertisement
biswasrohit20

in

May 5th, 2021
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. import random
  2. import numpy as np
  3.  
  4. def diceprob(k,n):
  5. sum = 0
  6. for i in range(n):
  7. a = random.randint(1, 6)
  8. b = random.randint(1, 6)
  9. if a != k and b != k:
  10. sum += 1
  11.  
  12. return sum/n
  13.  
  14.  
  15. np.random.seed(1)
  16. for k in range(1,7):
  17. print(k, diceprob(k, 100))
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement