Skip to content

Instantly share code, notes, and snippets.

@markojerkic
Created February 26, 2018 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markojerkic/4dfd67e4b2278a2e7d417b374fceed11 to your computer and use it in GitHub Desktop.
Save markojerkic/4dfd67e4b2278a2e7d417b374fceed11 to your computer and use it in GitHub Desktop.
import numpy as np
def k_possibilities(k):
res = np.random.rand(k)
_sum = sum(res)
for i, x in enumerate(res):
per = x / _sum
res[i] = per
return res
if __name__ == '__main__':
print(np.random.multinomial(500, k_possibilities(10)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment