Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. from __future__ import division
  2. import numpy as np
  3.  
  4. num_sides = 6
  5. bound = 200
  6. index = 66
  7. num_simulations = int(1e7)
  8.  
  9. rolls = np.random.randint(1, high=num_sides+1, size=[index, num_simulations])
  10. accum = np.sum(rolls, axis=0)
  11. samples = accum <= bound
  12. mean = np.mean(samples)
  13. var = np.var(samples)
  14.  
  15. print('mean: {}, var: {}'.format(mean, var))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement