time-to-botec

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

repl.txt (8202B)


      1 
      2 {{alias}}( [options] )
      3     Returns a readable stream for generating pseudorandom numbers on the
      4     interval `[1, 2147483646]`.
      5 
      6     In addition to standard readable stream events, the returned stream emits a
      7     'state' event after internally generating `siter` pseudorandom numbers,
      8     which is useful when wanting to deterministically capture a stream's
      9     underlying PRNG state.
     10 
     11     The underlying pseudorandom number generator (PRNG) is a linear congruential
     12     pseudorandom number generator (LCG) whose output is shuffled using the Bays-
     13     Durham algorithm. The shuffle step considerably strengthens the "randomness
     14     quality" of a simple LCG's output.
     15 
     16     The generator has a period of approximately `2.1e9`.
     17 
     18     An LCG is fast and uses little memory. On the other hand, because the
     19     generator is a simple LCG, the generator has recognized shortcomings. By
     20     today's PRNG standards, the generator's period is relatively short. In
     21     general, this generator is unsuitable for Monte Carlo simulations and
     22     cryptographic applications.
     23 
     24     Parameters
     25     ----------
     26     options: Object (optional)
     27         Options.
     28 
     29     options.objectMode: boolean (optional)
     30         Specifies whether a stream should operate in "objectMode". Default:
     31         false.
     32 
     33     options.encoding: string|null (optional)
     34         Specifies how Buffer objects should be decoded to strings. Default:
     35         null.
     36 
     37     options.highWaterMark: integer (optional)
     38         Specifies the maximum number of bytes to store in an internal buffer
     39         before ceasing to generate additional pseudorandom numbers.
     40 
     41     options.sep: string (optional)
     42         Separator used to join streamed data. This option is only applicable
     43         when a stream is not in "objectMode". Default: '\n'.
     44 
     45     options.iter: integer (optional)
     46         Number of iterations.
     47 
     48     options.normalized: boolean (optional)
     49         Boolean indicating whether to return pseudorandom numbers on the
     50         interval `[0,1)`.
     51 
     52     options.seed: integer|ArrayLikeObject<integer> (optional)
     53         Pseudorandom number generator seed. The seed may be either a positive
     54         signed 32-bit integer or, for arbitrary length seeds, an array-like
     55         object containing signed 32-bit integers.
     56 
     57     options.state: Int32Array (optional)
     58         Pseudorandom number generator state. If provided, the `seed` option is
     59         ignored.
     60 
     61     options.copy: boolean (optional)
     62         Boolean indicating whether to copy a provided pseudorandom number
     63         generator state. Setting this option to `false` allows sharing state
     64         between two or more pseudorandom number generators. Setting this option
     65         to `true` ensures that a returned iterator has exclusive control over
     66         its internal state. Default: true.
     67 
     68     options.siter: integer (optional)
     69         Number of iterations after which to emit the PRNG state. Default: 1e308.
     70 
     71     Returns
     72     -------
     73     stream: ReadableStream
     74         Readable stream.
     75 
     76     stream.seed: Int32Array|null
     77         Pseudorandom number generator seed.
     78 
     79     stream.seedLength: integer|null
     80         Length of generator seed.
     81 
     82     stream.state: Int32Array|null
     83         Generator state.
     84 
     85     stream.stateLength: integer|null
     86         Length of generator state.
     87 
     88     stream.byteLength: integer|null
     89         Size (in bytes) of generator state.
     90 
     91     Examples
     92     --------
     93     > function fcn( chunk ) { console.log( chunk.toString() ); };
     94     > var opts = { 'iter': 10 };
     95     > var s = {{alias}}( opts );
     96     > var o = {{alias:@stdlib/streams/node/inspect-sink}}( fcn );
     97     > s.pipe( o );
     98 
     99 
    100 {{alias}}.factory( [options] )
    101     Returns a function for creating readable streams which generate pseudorandom
    102     numbers on the interval `[1, 2147483646]`.
    103 
    104     Parameters
    105     ----------
    106     options.objectMode: boolean (optional)
    107         Specifies whether a stream should operate in "objectMode". Default:
    108         false.
    109 
    110     options.encoding: string|null (optional)
    111         Specifies how Buffer objects should be decoded to strings. Default:
    112         null.
    113 
    114     options.highWaterMark: integer (optional)
    115         Specifies the maximum number of bytes to store in an internal buffer
    116         before ceasing to generate additional pseudorandom numbers.
    117 
    118     options.sep: string (optional)
    119         Separator used to join streamed data. This option is only applicable
    120         when a stream is not in "objectMode". Default: '\n'.
    121 
    122     options.iter: integer (optional)
    123         Number of iterations.
    124 
    125     options.normalized: boolean (optional)
    126         Boolean indicating whether to return pseudorandom numbers on the
    127         interval `[0,1)`.
    128 
    129     options.seed: integer|ArrayLikeObject<integer> (optional)
    130         Pseudorandom number generator seed. The seed may be either a positive
    131         signed 32-bit integer or, for arbitrary length seeds, an array-like
    132         object containing signed 32-bit integers.
    133 
    134     options.state: Int32Array (optional)
    135         Pseudorandom number generator state. If provided, the `seed` option is
    136         ignored.
    137 
    138     options.copy: boolean (optional)
    139         Boolean indicating whether to copy a provided pseudorandom number
    140         generator state. Setting this option to `false` allows sharing state
    141         between two or more pseudorandom number generators. Setting this option
    142         to `true` ensures that a returned iterator has exclusive control over
    143         its internal state. Default: true.
    144 
    145     options.siter: integer (optional)
    146         Number of iterations after which to emit the PRNG state. Default: 1e308.
    147 
    148     Returns
    149     -------
    150     fcn: Function
    151         Function for creating readable streams.
    152 
    153     Examples
    154     --------
    155     > var opts = { 'objectMode': true, 'highWaterMark': 64 };
    156     > var createStream = {{alias}}.factory( opts );
    157 
    158 
    159 {{alias}}.objectMode( [options] )
    160     Returns an "objectMode" readable stream for generating pseudorandom numbers
    161     on the interval `[1, 2147483646]`.
    162 
    163     Parameters
    164     ----------
    165     options: Object (optional)
    166         Options.
    167 
    168     options.encoding: string|null (optional)
    169         Specifies how Buffer objects should be decoded to strings. Default:
    170         null.
    171 
    172     options.highWaterMark: integer (optional)
    173         Specifies the maximum number of objects to store in an internal buffer
    174         before ceasing to generate additional pseudorandom numbers.
    175 
    176     options.iter: integer (optional)
    177         Number of iterations.
    178 
    179     options.normalized: boolean (optional)
    180         Boolean indicating whether to return pseudorandom numbers on the
    181         interval `[0,1)`.
    182 
    183     options.seed: integer|ArrayLikeObject<integer> (optional)
    184         Pseudorandom number generator seed. The seed may be either a positive
    185         signed 32-bit integer or, for arbitrary length seeds, an array-like
    186         object containing signed 32-bit integers.
    187 
    188     options.state: Int32Array (optional)
    189         Pseudorandom number generator state. If provided, the `seed` option is
    190         ignored.
    191 
    192     options.copy: boolean (optional)
    193         Boolean indicating whether to copy a provided pseudorandom number
    194         generator state. Setting this option to `false` allows sharing state
    195         between two or more pseudorandom number generators. Setting this option
    196         to `true` ensures that a returned iterator has exclusive control over
    197         its internal state. Default: true.
    198 
    199     options.siter: integer (optional)
    200         Number of iterations after which to emit the PRNG state. Default: 1e308.
    201 
    202     Returns
    203     -------
    204     stream: ReadableStream
    205         Readable stream operating in "objectMode".
    206 
    207     stream.seed: Int32Array|null
    208         Pseudorandom number generator seed.
    209 
    210     stream.seedLength: integer|null
    211         Length of generator seed.
    212 
    213     stream.state: Int32Array|null
    214         Generator state.
    215 
    216     stream.stateLength: integer|null
    217         Length of generator state.
    218 
    219     stream.byteLength: integer|null
    220         Size (in bytes) of generator state.
    221 
    222     Examples
    223     --------
    224     > function fcn( v ) { console.log( v ); };
    225     > var opts = { 'iter': 10 };
    226     > var s = {{alias}}.objectMode( opts );
    227     > var o = {{alias:@stdlib/streams/node/inspect-sink}}.objectMode( fcn );
    228     > s.pipe( o );
    229 
    230     See Also
    231     --------
    232