Create random list of integers in Python

后端 未结 4 801
温柔的废话
温柔的废话 2020-11-29 20:17

I\'d like to create a random list of integers for testing purposes. The distribution of the numbers is not important. The only thing that is counting is time

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 20:41

    Your question about performance is moot—both functions are very fast. The speed of your code will be determined by what you do with the random numbers.

    However it's important you understand the difference in behaviour of those two functions. One does random sampling with replacement, the other does random sampling without replacement.

提交回复
热议问题