TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Generating π from 1,000 random numbers

1 pointsby e0mabout 8 years ago

1 comment

e0mabout 8 years ago
And a Tweet-length implementation: <a href="https:&#x2F;&#x2F;twitter.com&#x2F;E0M&#x2F;status&#x2F;841673345791803392" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;E0M&#x2F;status&#x2F;841673345791803392</a><p>for(m=Math,r=a=&gt;m.round(1e9*m.random()),g=(a,b)=&gt;b?g(b,a%b):a,p=0,i=0;i&lt;1e7;i++)if(1==g(r(),r()))p++;console.log(m.sqrt(6&#x2F;(p&#x2F;(1e7))));
评论 #13869137 未加载