Created
February 26, 2018 16:09
-
-
Save markojerkic/4dfd67e4b2278a2e7d417b374fceed11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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