/explore
|
You are here |
markodenic.com | ||
| | | | |
blog.alexanderkaran.com
Mastering Array Search with some, indexOf, and includes in JavaScript |
|
| | | | | ||
| | | | |
idiallo.com
There are many ways to detect if an object is an array. I found a single line of code to rule them all. |
|
| | | | | ||
| | | | |
mika-s.github.io
Here I introduce a method that can be used to generate random numbers drawn from a normal distribution. The code below uses the Box-Muller transform to make sure the numbers are normally distributed. function boxMullerTransform() { const u1 = Math.random(); const u2 = Math.random(); const z0 = Math.sqrt(-2.0 * Math.log(u1)) * Math.cos(2.0 * Math.PI * u2); const z1 = Math.sqrt(-2.0 * Math.log(u1)) * Math.sin(2.0 * Math.PI * u2); return { z0, z1 }; } function getNormallyDistributedRandomNumber(mean, stddev) { const { z0, _ } = boxMullerTransform(); return z0 * stddev + mean; } z1 isn't used in this case, but I'll leave it in in case boxMullerTransform() is used another place. This is how you can use getNormallyDistributedRandomNumber(): const generatedNumbers ... |
|
| | | | | ||
| | | | |
stevenhicks.me
I built a URL expander with Netlify functions, and connected my browser to it with a custom search engine. It saves me about 1 minute per day and now it feels like my search bar is a CLI. |
|
| | | |||