# Mx.nd.multinomial() output the same results each running?

from mxnet import nd
prob_each = nd.array([0.5,0.5])#.reshape(1,2)
for k in range(3):
a = nd.random.multinomial(prob_each,shape=(2,1)).asnumpy()
print a,’-’

hi all i run codes above many times with all results are 1.
but i think it should output 0 or 1 randomly?

It does look strange. I have created an issue on your behalf: https://github.com/apache/incubator-mxnet/issues/14183 Hopefully, someone from the community will pick it up.

In the meantime, I can only recommend using numpy to draw samples from the multinominal distribution and then convert it into NDArray by `mx.nd.array(np_array)`.
{"ft_lang_label":"__label__en","ft_lang_prob":0.6661639,"math_prob":0.9186151,"size":262,"snap":"2020-34-2020-40","text_gpt3_token_len":87,"char_repetition_ratio":0.08527132,"word_repetition_ratio":0.0,"special_character_ratio":0.33587787,"punctuation_ratio":0.22058824,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9547575,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-09-28T00:42:38Z\",\"WARC-Record-ID\":\"<urn:uuid:636d6063-e2bf-4810-bbe7-500d2f26867a>\",\"Content-Length\":\"14822\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:d81b5f3e-8aab-4bcf-a3d4-b9be8512b458>\",\"WARC-Concurrent-To\":\"<urn:uuid:158bca6c-fb2e-4420-bdaa-5f3c5684ebf9>\",\"WARC-IP-Address\":\"72.52.80.15\",\"WARC-Target-URI\":\"https://discuss.mxnet.apache.org/t/mx-nd-multinomial-output-the-same-results-each-running/3226\",\"WARC-Payload-Digest\":\"sha1:PNLROTPCMRVCBS6HMXE47EE4OHLD4M3D\",\"WARC-Block-Digest\":\"sha1:B2NP6FARYLXPIIWXNXIUVURXGQ7ZG6EK\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-40/CC-MAIN-2020-40_segments_1600401582033.88_warc_CC-MAIN-20200927215009-20200928005009-00092.warc.gz\"}"}