Brando
Brando (Cave Canem).
###Install
$ npm install brando [-g]
require:
var Brando = require( 'brando' );
###Run Tests
to run all test files, install devDependecies:
$ cd brando/
$ npm install --dev
$ npm test
to execute a single test file simply do:
$ node test/file-name.js
###Methods
Arguments within [ ] are optional.
####Brando.sham
Print some informational numbers about a particular sequence or permutation,
without creating anything.
Brando#sham : function ( Number items, Number range [, Number repeat ] ) : undefined
####Brando.emt
A simple factory method, it returns an EventEmitter that parses random data and emits results
with the number of selected items and within the selected range. Internally, it creates an empty
Buffer of the length necessary to hold all requested values. It is possible to fill it with values
generated through Math.Random (biased result) or through a random source of data.
If repetition is off, it returns a Sequence, otherwise a
sub-type of Sequence; when items value is equal to range, it returns a FullPerm,
otherwise a PartPerm.
Brando#emt : function ( Number items, Number range [, Number repeat ] ) : Sequence
NOTE:
- max allowed value for items and range is 2^(32)-1, or 4 bytes values.
- max output size for sequences is 16GB. Virtually, there is no size limit
for sequences with repetitions, but the max length for FP and PP is limited
to:
- ( 2^32 values ) * ( 4 bytes/value ), or 16GB.
See also emitter examples.
####Transform Streams
Use a Transform stream to consume random data from an input source, it outputs
results within the selected range of values, limiting the number to items.
####Brando.stream
A simple factory method, it returns a SeqTransStream
(stream.Transform), or a sub-type between FPTransStream
and PPTransStream.
Brando#stream : function ( Number items, Number range [, Number repeat [, Object stream_opt ] ] ) : SeqTransStream
NOTE:
- How many bytes will be consumed to produce 1 byte of result, depends on many factors,
items, range, repetition, but moreover on the quality of random data, parsed from the input
source to pipe in.
See also stream examples.
MIT License
Copyright (c) 2014 < Guglielmo Ferri : 44gatti@gmail.com >
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.