How to generate exponentially increasing range in Python

前端 未结 8 1240
醉梦人生
醉梦人生 2020-12-15 23:05

I want to test the performance of some code using an exponentially increasing value. So that as an extra digit is added to the numbers_size the increment is multiplied by 1

8条回答
  •  情书的邮戳
    2020-12-15 23:43

    example of 'NOT reading the question properly' and 'NOT how to do it'

    for i in xrange(100, 1000000000, 100):
        # timer
        test(i)
        # whatever
    

    Is about as simple as it gets... adjust xrange accordingly

提交回复
热议问题