37,720
社区成员
发帖
与我相关
我的任务
分享
In [323]: def recur_depth(n):
...: depth = 0
...: while n>1:
...: n = n*(0.5 + random.random()/2)
...: depth += 1
...: return depth
In [324]: max_recurrsion_depth_in_500000_times = max(recur_depth(100000) for _ in xrange(500000))
In [325]: max_recurrsion_depth_in_500000_times
Out[325]: 60