https://github.com/girkovarpa/zipf
TypeScript implementation of the Vsauce paperclip experiment.
https://github.com/girkovarpa/zipf
deno experiment typescript zipf zipfs-law
Last synced: about 1 month ago
JSON representation
TypeScript implementation of the Vsauce paperclip experiment.
- Host: GitHub
- URL: https://github.com/girkovarpa/zipf
- Owner: GirkovArpa
- License: unlicense
- Created: 2020-08-11T20:43:17.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-11T20:43:32.000Z (almost 6 years ago)
- Last Synced: 2025-03-18T02:47:08.632Z (over 1 year ago)
- Topics: deno, experiment, typescript, zipf, zipfs-law
- Language: TypeScript
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Zipf
Link random pairs of paperclips in a pool then observe the distribution of chain lengths.
Does it follow **Zipf's Law?**
Inspired by [this](https://www.youtube.com/watch?v=fCn8zs912OE) **Vsauce** video.
# Usage
Since this is a TypeScript project, you can run it immediately without manual compilation using **Deno**:
```
$ deno run zipf.ts
```
```javascript
const pool: number[][] = linkRandPairs(10, 5);
const result: number[] = pool.map(toLength).sort(numerically);
console.log({ result });
// { result: [ 1, 1, 1, 2, 5 ] }
```