Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface defining a stream constructor which is both "newable" and "callable".

Hierarchy

  • Constructor

Callable

  • Stream constructor for generating a stream of pseudorandom numbers drawn from a standard normal distribution using the Box-Muller transform.

    throws

    must provide valid options

    throws

    must provide a valid state

    Parameters

    • Optional options: Options

      stream options

    Returns RandomStream

    Stream instance

    Example

    var inspectStream = require( `@stdlib/streams/node/inspect-sink` );
    
    function log( chunk ) {
       console.log( chunk.toString() );
    }
    
    var opts = {
        'iter': 10
    };
    
    var stream = randomStream( opts );
    
    stream.pipe( inspectStream( log )  );

Index

Constructors

Methods

Constructors

constructor

  • Stream constructor for generating a stream of pseudorandom numbers drawn from a standard normal distribution using the Box-Muller transform.

    throws

    must provide valid options

    throws

    must provide a valid state

    Parameters

    • Optional options: Options

      stream options

    Returns RandomStream

    Stream instance

    Example

    var inspectStream = require( `@stdlib/streams/node/inspect-sink` );
    
    function log( chunk ) {
       console.log( chunk.toString() );
    }
    
    var opts = {
        'iter': 10
    };
    
    var RandomStream = randomStream;
    var stream = new RandomStream( opts );
    
    stream.pipe( inspectStream( log )  );

Methods

factory

  • Returns a function for creating readable streams which generate pseudorandom numbers drawn from a standard normal distribution using the Box-Muller transform.

    Parameters

    • Optional options: Options

      stream options

    Returns ( ) => RandomStream

    stream factory

    Example

    var opts = {
        'sep': ',',
        'objectMode': false,
        'encoding': 'utf8',
        'highWaterMark': 64
    };
    
    var createStream = randomStream.factory( opts );
    
    // Create 10 identically configured streams...
    var streams = [];
    var i;
    for ( i = 0; i < 10; i++ ) {
        streams.push( createStream() );
    }

objectMode

  • Returns an "objectMode" readable stream for generating pseudorandom numbers drawn from a standard normal distribution using the Box-Muller transform.

    throws

    must provide valid options

    throws

    must provide a valid state

    Parameters

    • Optional options: Options

      stream options

    Returns RandomStream

    Stream instance

    Example

    var inspectStream = require( `@stdlib/streams/node/inspect-sink` );
    
    function log( v ) {
       console.log( v );
    }
    
    var opts = {
        'iter': 10
    };
    
    var stream = randomStream.objectMode( opts );
    
    stream.pipe( inspectStream.objectMode( log ) );