News for hackers. Stuff that matters.
Re:Computer Scientists Invent an Efficient New Way to Count by kuldeepmeel on Saturday May 18, 2024 @03:52AM (#40397197)
Yes, there is an error in the Quanta article [at the same time, I must add that writing popular science articles is very hard, so it would be wrong to blame them]

Your fix is indeed correct; we may want to have either while loop instead of "if len(mem) == thresh" as there is very small (but non-zero) probability that length of mem is still thresh after executing: mem = [m for m in mem if np.random.rand() < 0.5]

["While" was Knuth's idea; and has added benefit of providing unbiased estimator.]

There are no comments on this comment yet.