Fastest Way to generate 1,000,000+ random numbers in python

后端 未结 6 714
时光取名叫无心
时光取名叫无心 2020-12-13 19:28

I am currently writing an app in python that needs to generate large amount of random numbers, FAST. Currently I have a scheme going that uses numpy to generate all of the n

6条回答
  •  长情又很酷
    2020-12-13 20:15

    Just a quick example of numpy in action:

    data = numpy.random.rand(1000000)
    

    No need for loop, you can pass in how many numbers you want to generate.

提交回复
热议问题