[untitled]
1 pointsby peterhull900 comments
def loop():
for number in range(10):
def outer(n):
def inner():
return n
return inner
yield outer(number)
Is there a neater way?
Also, the article links to a blog by Daniel Lemire [1] in which he says (with regard to producing an unbiased random float) "picking an integer in [0,2^32) at random and dividing it by 2^32, was equivalent to picking a number at random in [0,1)" is incorrect and there is a ratio of up to 257:1 in the distribution so obtained. Not wanting to disagree with Daniel Lemire but I can't see why, and a quick experiment in Python didn't give this ratio.
[0]: https://news.ycombinator.com/item?id=41112688
[1]: https://lemire.me/blog/2017/02/28/how-many-floating-point-nu...