Efficiently generating multiple instances of numpy.random.choice without replacement

后端 未结 4 1716
一个人的身影
一个人的身影 2020-12-10 18:48

I\'m new to Python. While reading, please mention any other suggestions regarding ways to improve my Python code.

Question: How do I generate a 8x

4条回答
  •  爱一瞬间的悲伤
    2020-12-10 19:13

    Use below code for your array generation

    import numpy as np
    N=1e7 # THe value you want to have
    np.random.randint(1,high=8,size=(8,N))
    

    Hope this helps, it will surely not going to take that much time.

提交回复
热议问题