https://github.com/willscott/zipfian
Zipf Distribution Generation for Node.js
https://github.com/willscott/zipfian
Last synced: 11 months ago
JSON representation
Zipf Distribution Generation for Node.js
- Host: GitHub
- URL: https://github.com/willscott/zipfian
- Owner: willscott
- License: apache-2.0
- Created: 2014-05-02T05:31:02.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-07-26T05:57:21.000Z (almost 12 years ago)
- Last Synced: 2025-03-08T23:34:30.490Z (over 1 year ago)
- Language: JavaScript
- Size: 204 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
zipfian
=======
Zipf Distribution Generation for Node.js
[](https://en.wikipedia.org/wiki/Zipf's_law)
Usage
-----
To generate a zipf generator, create an instance of ZipfGenerator, and then get your numbers!
```javascript
var zipfGenerator = require('zipfian').getGenerator(1000);
console.log(zipfGenerator.next());
```
If you want more control over the generator parameters, you can create the generator yourself.
```javascript
var Generator = require('zipfian').ZipfGenerator;
var zipfGenerator = new Generator(min, max, zipfConstant);
```
Bugs + Contributing
-------------------
Please submit bugs or feature requests in github issues. In particular, this implementation
is missing the ability to resize the generator found in previous implementation. Contributions
are welcome!
Todo
----
- Resizing a generator
- Scrambled generator