time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

index.js (2236B)


      1 /**
      2 * @license Apache-2.0
      3 *
      4 * Copyright (c) 2018 The Stdlib Authors.
      5 *
      6 * Licensed under the Apache License, Version 2.0 (the "License");
      7 * you may not use this file except in compliance with the License.
      8 * You may obtain a copy of the License at
      9 *
     10 *    http://www.apache.org/licenses/LICENSE-2.0
     11 *
     12 * Unless required by applicable law or agreed to in writing, software
     13 * distributed under the License is distributed on an "AS IS" BASIS,
     14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15 * See the License for the specific language governing permissions and
     16 * limitations under the License.
     17 */
     18 
     19 'use strict';
     20 
     21 /**
     22 * Create a readable stream for generating pseudorandom numbers drawn from a chi distribution.
     23 *
     24 * @module @stdlib/random/streams/chi
     25 *
     26 * @example
     27 * var inspectStream = require( '@stdlib/streams/node/inspect-sink' );
     28 * var randomStream = require( '@stdlib/random/streams/chi' );
     29 *
     30 * function log( chunk ) {
     31 *    console.log( chunk.toString() );
     32 * }
     33 *
     34 * var opts = {
     35 *     'iter': 10
     36 * };
     37 *
     38 * var stream = randomStream( 2.0, opts );
     39 *
     40 * stream.pipe( inspectStream( log ) );
     41 *
     42 * @example
     43 * var randomStream = require( '@stdlib/random/streams/chi' );
     44 *
     45 * var opts = {
     46 *     'sep': ',',
     47 *     'objectMode': false,
     48 *     'encoding': 'utf8',
     49 *     'highWaterMark': 64
     50 * };
     51 *
     52 * var createStream = randomStream.factory( opts );
     53 *
     54 * // Create 10 identically configured streams...
     55 * var streams = [];
     56 * var i;
     57 * for ( i = 0; i < 10; i++ ) {
     58 *     streams.push( createStream( 2.0 ) );
     59 * }
     60 *
     61 * @example
     62 * var inspectStream = require( '@stdlib/streams/node/inspect-sink' );
     63 * var randomStream = require( '@stdlib/random/streams/chi' );
     64 *
     65 * function log( v ) {
     66 *    console.log( v );
     67 * }
     68 *
     69 * var opts = {
     70 *     'iter': 10
     71 * };
     72 *
     73 * var stream = randomStream.objectMode( 2.0, opts );
     74 *
     75 * stream.pipe( inspectStream.objectMode( log ) );
     76 */
     77 
     78 
     79 // MODULES //
     80 
     81 var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
     82 var stream = require( './main.js' );
     83 var objectMode = require( './object_mode.js' );
     84 var factory = require( './factory.js' );
     85 
     86 
     87 // MAIN //
     88 
     89 setReadOnly( stream, 'objectMode', objectMode );
     90 setReadOnly( stream, 'factory', factory );
     91 
     92 
     93 // EXPORTS //
     94 
     95 module.exports = stream;