{"_id":"sequin","_rev":"942854","name":"sequin","description":"Generate uniformly distributed ints in any base from a bit sequence","dist-tags":{"latest":"0.1.1"},"maintainers":[{"name":"jcoglan","email":"jcoglan@gmail.com"}],"time":{"modified":"2021-09-23T02:09:05.000Z","created":"2013-09-14T15:31:57.926Z","0.1.1":"2017-04-17T15:55:46.415Z","0.1.0":"2013-09-14T15:31:57.926Z"},"users":{},"author":{"name":"James Coglan","email":"jcoglan@gmail.com","url":"http://jcoglan.com/"},"repository":{"type":"git","url":"git://github.com/jcoglan/sequin.git"},"versions":{"0.1.1":{"name":"sequin","description":"Generate uniformly distributed ints in any base from a bit sequence","homepage":"https://github.com/jcoglan/sequin","author":{"name":"James Coglan","email":"jcoglan@gmail.com","url":"http://jcoglan.com/"},"keywords":["math"],"license":"MIT","version":"0.1.1","engines":{"node":">=0.4.0"},"main":"./lib/sequin","devDependencies":{"jstest":""},"scripts":{"test":"jstest spec/sequin_spec.js"},"repository":{"type":"git","url":"git://github.com/jcoglan/sequin.git"},"bugs":{"url":"https://github.com/jcoglan/sequin/issues"},"gitHead":"babec11c3bdaef033f0f4cf19d34d8fe6306a546","_id":"sequin@0.1.1","_shasum":"5c2d389d66a383734eaafbc45edeb2c1cb1be701","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.8.2","_npmUser":{"name":"jcoglan","email":"jcoglan@gmail.com"},"dist":{"shasum":"5c2d389d66a383734eaafbc45edeb2c1cb1be701","size":2215,"noattachment":false,"key":"/sequin/-/sequin-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/sequin/download/sequin-0.1.1.tgz"},"maintainers":[{"name":"jcoglan","email":"jcoglan@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/sequin-0.1.1.tgz_1492444545872_0.9142960654571652"},"directories":{},"publish_time":1492444546415,"_cnpm_publish_time":1492444546415,"_hasShrinkwrap":false},"0.1.0":{"name":"sequin","description":"Generate uniformly distributed ints in any base from a bit sequence","homepage":"http://github.com/jcoglan/sequin","author":{"name":"James Coglan","email":"jcoglan@gmail.com","url":"http://jcoglan.com/"},"keywords":["math"],"license":"MIT","version":"0.1.0","engines":{"node":">=0.4.0"},"main":"./lib/sequin","devDependencies":{"jstest":""},"scripts":{"test":"jstest spec/sequin_spec.js"},"repository":{"type":"git","url":"git://github.com/jcoglan/sequin.git"},"bugs":{"name":"http://github.com/jcoglan/sequin/issues"},"_npmUser":{"name":"jcoglan","email":"jcoglan@gmail.com"},"_id":"sequin@0.1.0","dependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.6.19","_defaultsLoaded":true,"dist":{"shasum":"17c5566d9d555413aa12fc8bc96ed309c80e0aad","size":2172,"noattachment":false,"key":"/sequin/-/sequin-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sequin/download/sequin-0.1.0.tgz"},"maintainers":[{"name":"jcoglan","email":"jcoglan@gmail.com"}],"directories":{},"publish_time":1379172717926,"_hasShrinkwrap":false,"_cnpm_publish_time":1379172717926}},"readme":"# sequin [![Build status](https://secure.travis-ci.org/jcoglan/sequin.png)](https://travis-ci.org/jcoglan/sequin)\n\nGenerates uniformly distributed ints in any base from a bit sequence, according\nto the algorithm [described by Christian\nPerfect](http://checkmyworking.com/2012/06/converting-a-stream-of-binary-digits-to-a-stream-of-base-n-digits/).\n\n\n## Installation\n\n```\n$ npm install sequin\n```\n\n\n## Usage\n\nConstruct a stream using an array of `0`/`1` values, or using a `Buffer` with\nthe second argument set to `8`:\n\n```js\nvar Sequin = require('sequin'),\n    crypto = require('crypto'),\n    stream = new Sequin(crypto.randomBytes(10), 8);\n```\n\nThe stream's `generate(k)` method returns an integer less than `k`, or `null` if\nthere are not enough bits left in the stream to generate an integer of the\nrequired size.\n\n```js\nvar Sequin = require('sequin'),\n    stream = new Sequin([1,1,0,1,0,1,0,1,1,1,1,1,0,0,1]);\n\nstream.generate(5) // -> 3\nstream.generate(5) // -> 3\nstream.generate(5) // -> 1\nstream.generate(5) // -> null\n```\n\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2012-2017 James Coglan\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the 'Software'), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_attachments":{},"homepage":"https://github.com/jcoglan/sequin","bugs":{"url":"https://github.com/jcoglan/sequin/issues"},"license":"MIT"}