{"id":17771414,"url":"https://github.com/rootslab/brando","last_synced_at":"2025-04-01T15:18:25.675Z","repository":{"id":24797459,"uuid":"28211393","full_name":"rootslab/brando","owner":"rootslab","description":"Brando, is a module to handle / generate pseudo-random sequences/permutations of integers using Buffers.","archived":false,"fork":false,"pushed_at":"2015-02-01T23:13:42.000Z","size":1360,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-08T17:43:09.958Z","etag":null,"topics":["permutations","pseudo-random","random","random-sequences","random-shuffle"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rootslab.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-19T02:47:02.000Z","updated_at":"2017-11-09T00:01:22.000Z","dependencies_parsed_at":"2022-08-22T16:50:53.173Z","dependency_job_id":null,"html_url":"https://github.com/rootslab/brando","commit_stats":null,"previous_names":[],"tags_count":57,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fbrando","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fbrando/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fbrando/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fbrando/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rootslab","download_url":"https://codeload.github.com/rootslab/brando/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246660075,"owners_count":20813338,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["permutations","pseudo-random","random","random-sequences","random-shuffle"],"created_at":"2024-10-26T21:32:47.422Z","updated_at":"2025-04-01T15:18:25.654Z","avatar_url":"https://github.com/rootslab.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Brando\n\n[![NPM VERSION](http://img.shields.io/npm/v/brando.svg?style=flat)](https://www.npmjs.org/package/brando)\n[![CODACY BADGE](https://img.shields.io/codacy/b18ed7d95b0a4707a0ff7b88b30d3def.svg?style=flat)](https://www.codacy.com/public/44gatti/brando)\n[![CODECLIMATE](http://img.shields.io/codeclimate/github/rootslab/brando.svg?style=flat)](https://codeclimate.com/github/rootslab/brando)\n[![CODECLIMATE-TEST-COVERAGE](https://img.shields.io/codeclimate/coverage/github/rootslab/brando.svg?style=flat)](https://codeclimate.com/github/rootslab/brando)\n[![LICENSE](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/rootslab/brando#mit-license)\n\n[![TRAVIS CI BUILD](http://img.shields.io/travis/rootslab/brando.svg?style=flat)](http://travis-ci.org/rootslab/brando)\n[![BUILD STATUS](http://img.shields.io/david/rootslab/brando.svg?style=flat)](https://david-dm.org/rootslab/brando)\n[![DEVDEPENDENCY STATUS](http://img.shields.io/david/dev/rootslab/brando.svg?style=flat)](https://david-dm.org/rootslab/brando#info=devDependencies)\n[![NPM DOWNLOADS](http://img.shields.io/npm/dm/brando.svg?style=flat)](http://npm-stat.com/charts.html?package=brando)\n\n[![NPM GRAPH1](https://nodei.co/npm-dl/brando.png)](https://nodei.co/npm/brando/)\n\n[![NPM GRAPH2](https://nodei.co/npm/brando.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/brando/)\n\n[![status](https://sourcegraph.com/api/repos/github.com/rootslab/brando/.badges/status.png)](https://sourcegraph.com/github.com/rootslab/brando)\n[![views](https://sourcegraph.com/api/repos/github.com/rootslab/brando/.counters/views.png)](https://sourcegraph.com/github.com/rootslab/brando)\n[![views 24h](https://sourcegraph.com/api/repos/github.com/rootslab/brando/.counters/views-24h.png)](https://sourcegraph.com/github.com/rootslab/brando)\n\n\u003e __Brando__ is a module to handle __pseudo-random sequences/permutations__ of integers using Buffers.\n\n###Install\n\n```bash\n$ npm install brando [-g]\n```\n\n\u003e __require__:\n\n```javascript\nvar Brando  = require( 'brando' );\n```\n###Run Tests\n\n\u003e __to run all test files, install devDependecies:__\n\n```bash\n $ cd brando/\n # install or update devDependecies \n $ npm install --dev\n # run tests\n $ npm test\n```\n\u003e __to execute a single test file simply do__:\n\n```bash\n $ node test/file-name.js\n```\n\n###Run Benchmarks\n\n\u003e run miscellaneous benchmarks for Brando\n\n```bash\n $ cd brando/\n $ npm run bench\n```\n----------------------------------------------------------------------------------------------\n\n###Methods\n\n\u003e Arguments within [ ] are optional.\n\n####Brando.sham\n\n\u003e Print some informational numbers about a particular sequence or permutation,\n\u003e without creating anything.\n\n```javascript\nBrando#sham : function ( Number items, Number range [, Number repeat ] ) : undefined\n```\n\n####Brando.emt\n\n\u003e A simple factory method, it returns an EventEmitter that parses random data and emits results\n\u003e with the number of selected items and within the selected range (__unsigned integers__). Internally,\n\u003e it creates an empty Buffer of the length necessary to hold all requested values, thent is possible\n\u003e to fill it with values generated through Math.Random (biased result) or through a random source\n\u003e of data.\n\n\u003e __NOTE:__ If repetition is off, it returns a [Sequence](lib/filters/emitters/sequence), otherwise, when items value is equal to range, it returns a [FullPerm](lib/filters/emitters/fullperm), otherwise a [PartPerm](lib/filters/emitters/partperm).\n\n```javascript\n/*\n * For default, repeat = +Infinity, or unlimited repetitions.\n *\n * - if repeat === 1\n *   - if items \u003e= range, it returns a FullPerm.\n *   - if items \u003c range, a PartPerm.\n *\n * - otherwise, it returns a Sequence (unlimited repetitions).\n *\n * Every instance of the Sequence EventEmitter, has 3 methods:\n * \n * - for filling the Buffer with Math.random:\n *\n *   Sequence#fill : function () : Sequence\n *\n * - for executing multiple times a Fisher-Yates shuffle (using Math.random)\n *\n *   Sequence#shuffle : function ( [ Number times ] ) : Sequence\n *\n * - before reusing Sequence, resetting internal status and/or set a new result buffer:\n *\n *   Sequence#clear : function ( [ Boolean trash [, Boolean refill ] ] ) : Sequence\n *\n * - for parsing input data from a random source:\n *\n *   Sequence#parse : function ( Buffer data ) : undefined\n *\n * - using #parse, Sequence emits:\n *   - 'feed' when needs more data: function ( Number miss_bytes, Number curr_usage_ratio )\n *   - 'fart' when result is ready: function ( Buffer result, Number curr_usage_ratio )\n */\nBrando#emt : function ( Number items, Number range [, Number repeat ] ) : Sequence\n```\n\u003e __NOTE__:\n\u003e - max allowed value for items and range is __2^(32)-1__, or __4 bytes__ values.\n\u003e - max output size for sequences is __16GB__. Virtually, there is no size limit\n\u003e   for sequences with repetitions, but the max length for __FP__ and __PP__ is limited\n\u003e   to:\n\u003e   - ( __2^32__ values ) * ( __4__ bytes/value ), or __16GB__.\n\n\u003e See also __[emitter examples](example/)__.\n\n------------------------------------------------------------------------------------\n\n####Transform Streams\n\n\u003e Use a Transform stream to consume random data from an input source, it outputs\n\u003e results within the selected _range_ of values, limiting the number to _items_.\n\n####Brando.stream\n\n\u003e A simple factory method, it returns a _[SeqTransStream](lib/filters/streams/sequence-transform)_\n\u003e (_stream.Transform_), or a sub-type between _[FPTransStream](lib/filters/streams/fullperm-transform)_\n\u003e and _[PPTransStream](lib/filters/streams/partperm-transform)_.\n\n```javascript\n/*\n * For default, repeat = +Infinity, or unlimited repetitions.\n *\n * - if repeat === 1, it returns a stream that filters a full or a partial permutation.\n *   - if items \u003e= range, it returns a FPTransStream.\n *   - if items \u003c range, a PPTransStream.\n *\n * - otherwise, it returns a SeqTransStream (unlimited repetitions).\n *   - if items === 0, the stream consume all data that it receives, until stream ends.\n *\n * - for default, stream_opt is:\n * {\n *  highWaterMark : 16 * 1024\n *  , encoding : null\n *  , objectMode : false\n }\n */\nBrando#stream : function ( Number items, Number range [, Number repeat [, Object stream_opt ] ] ) : SeqTransStream\n```\n\u003e __NOTE__:\n\u003e  - __How many bytes will be consumed__ to produce 1 byte of result, __depends on many factors__,\n\u003e   items, range, repetition, but __moreover on the quality of random data__, parsed from the input\n\u003e   source to pipe in.\n\n\u003e See also __[stream examples](example/)__.\n\n\n### MIT License\n\n\u003e Copyright (c) 2015 \u0026lt; Guglielmo Ferri : 44gatti@gmail.com \u0026gt;\n\n\u003e Permission is hereby granted, free of charge, to any person obtaining\n\u003e a copy of this software and associated documentation files (the\n\u003e 'Software'), to deal in the Software without restriction, including\n\u003e without limitation the rights to use, copy, modify, merge, publish,\n\u003e distribute, sublicense, and/or sell copies of the Software, and to\n\u003e permit persons to whom the Software is furnished to do so, subject to\n\u003e the following conditions:\n\n\u003e __The above copyright notice and this permission notice shall be\n\u003e included in all copies or substantial portions of the Software.__\n\n\u003e THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\n\u003e EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\u003e MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n\u003e IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n\u003e CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n\u003e TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n\u003e SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n[![GA](https://ga-beacon.appspot.com/UA-53998692-1/brando/Readme?pixel)](https://github.com/igrigorik/ga-beacon)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootslab%2Fbrando","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frootslab%2Fbrando","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootslab%2Fbrando/lists"}