Skip to content

Instantly share code, notes, and snippets.

@Ginden
Created June 26, 2019 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ginden/aba95899da702b6b9b67ddbddf1f7dee to your computer and use it in GitHub Desktop.
Save Ginden/aba95899da702b6b9b67ddbddf1f7dee to your computer and use it in GitHub Desktop.
const _ = require('lodash');
function bm() {
var u = 0, v = 0;
while(u === 0) u = Math.random(); //Converting [0,1) to (0,1)
while(v === 0) v = Math.random();
return Math.sqrt( -2.0 * Math.log( u ) ) * Math.cos( 2.0 * Math.PI * v );
}
console.log(
_(_.range(1900, 2020))
.map(x => [x, (25 + 3 * bm() + (x-1900)/100)])
.sortBy(1)
.reverse()
.slice(0,20)
.map(0)
.filter(x => x < 2000)
.value()
.length
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment