repl.txt (8565B)
1 2 {{alias}}( [options] ) 3 Returns a readable stream for generating pseudorandom numbers drawn from a 4 standard normal distribution using the Box-Muller transform. 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 Parameters 12 ---------- 13 options: Object (optional) 14 Options. 15 16 options.objectMode: boolean (optional) 17 Specifies whether a stream should operate in "objectMode". Default: 18 false. 19 20 options.encoding: string|null (optional) 21 Specifies how Buffer objects should be decoded to strings. Default: 22 null. 23 24 options.highWaterMark: integer (optional) 25 Specifies the maximum number of bytes to store in an internal buffer 26 before ceasing to generate additional pseudorandom numbers. 27 28 options.sep: string (optional) 29 Separator used to join streamed data. This option is only applicable 30 when a stream is not in "objectMode". Default: '\n'. 31 32 options.iter: integer (optional) 33 Number of iterations. 34 35 options.prng: Function (optional) 36 Pseudorandom number generator (PRNG) for generating uniformly 37 distributed pseudorandom numbers on the interval `[0,1)`. If provided, 38 the `state` and `seed` options are ignored. In order to seed the 39 returned iterator, one must seed the provided `prng` (assuming the 40 provided `prng` is seedable). 41 42 options.seed: integer|ArrayLikeObject<integer> (optional) 43 Pseudorandom number generator seed. The seed may be either a positive 44 unsigned 32-bit integer or, for arbitrary length seeds, an array-like 45 object containing unsigned 32-bit integers. 46 47 options.state: Uint32Array (optional) 48 Pseudorandom number generator state. If provided, the `seed` option is 49 ignored. 50 51 options.copy: boolean (optional) 52 Boolean indicating whether to copy a provided pseudorandom number 53 generator state. Setting this option to `false` allows sharing state 54 between two or more pseudorandom number generators. Setting this option 55 to `true` ensures that a returned iterator has exclusive control over 56 its internal state. Default: true. 57 58 options.siter: integer (optional) 59 Number of iterations after which to emit the PRNG state. Default: 1e308. 60 61 Returns 62 ------- 63 stream: ReadableStream 64 Readable stream. 65 66 stream.PRNG: Function 67 Underlying pseudorandom number generator. 68 69 stream.seed: Uint32Array|null 70 Pseudorandom number generator seed. 71 72 stream.seedLength: integer|null 73 Length of generator seed. 74 75 stream.state: Uint32Array|null 76 Generator state. 77 78 stream.stateLength: integer|null 79 Length of generator state. 80 81 stream.byteLength: integer|null 82 Size (in bytes) of generator state. 83 84 Examples 85 -------- 86 > function fcn( chunk ) { console.log( chunk.toString() ); }; 87 > var opts = { 'iter': 10 }; 88 > var s = {{alias}}( opts ); 89 > var o = {{alias:@stdlib/streams/node/inspect-sink}}( fcn ); 90 > s.pipe( o ); 91 92 93 {{alias}}.factory( [options] ) 94 Returns a function for creating readable streams which generate pseudorandom 95 numbers drawn from a standard normal distribution using the Box-Muller 96 transform. 97 98 Parameters 99 ---------- 100 options: Object (optional) 101 Options. 102 103 options.objectMode: boolean (optional) 104 Specifies whether a stream should operate in "objectMode". Default: 105 false. 106 107 options.encoding: string|null (optional) 108 Specifies how Buffer objects should be decoded to strings. Default: 109 null. 110 111 options.highWaterMark: integer (optional) 112 Specifies the maximum number of bytes to store in an internal buffer 113 before ceasing to generate additional pseudorandom numbers. 114 115 options.sep: string (optional) 116 Separator used to join streamed data. This option is only applicable 117 when a stream is not in "objectMode". Default: '\n'. 118 119 options.iter: integer (optional) 120 Number of iterations. 121 122 options.prng: Function (optional) 123 Pseudorandom number generator (PRNG) for generating uniformly 124 distributed pseudorandom numbers on the interval `[0,1)`. If provided, 125 the `state` and `seed` options are ignored. In order to seed the 126 returned iterator, one must seed the provided `prng` (assuming the 127 provided `prng` is seedable). 128 129 options.seed: integer|ArrayLikeObject<integer> (optional) 130 Pseudorandom number generator seed. The seed may be either a positive 131 unsigned 32-bit integer or, for arbitrary length seeds, an array-like 132 object containing unsigned 32-bit integers. 133 134 options.state: Uint32Array (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 drawn from a standard normal distribution using the Box-Muller transform. 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.prng: Function (optional) 180 Pseudorandom number generator (PRNG) for generating uniformly 181 distributed pseudorandom numbers on the interval `[0,1)`. If provided, 182 the `state` and `seed` options are ignored. In order to seed the 183 returned iterator, one must seed the provided `prng` (assuming the 184 provided `prng` is seedable). 185 186 options.seed: integer|ArrayLikeObject<integer> (optional) 187 Pseudorandom number generator seed. The seed may be either a positive 188 unsigned 32-bit integer or, for arbitrary length seeds, an array-like 189 object containing unsigned 32-bit integers. 190 191 options.state: Uint32Array (optional) 192 Pseudorandom number generator state. If provided, the `seed` option is 193 ignored. 194 195 options.copy: boolean (optional) 196 Boolean indicating whether to copy a provided pseudorandom number 197 generator state. Setting this option to `false` allows sharing state 198 between two or more pseudorandom number generators. Setting this option 199 to `true` ensures that a returned iterator has exclusive control over 200 its internal state. Default: true. 201 202 options.siter: integer (optional) 203 Number of iterations after which to emit the PRNG state. Default: 1e308. 204 205 Returns 206 ------- 207 stream: ReadableStream 208 Readable stream operating in "objectMode". 209 210 stream.PRNG: Function 211 Underlying pseudorandom number generator. 212 213 stream.seed: Uint32Array|null 214 Pseudorandom number generator seed. 215 216 stream.seedLength: integer|null 217 Length of generator seed. 218 219 stream.state: Uint32Array|null 220 Generator state. 221 222 stream.stateLength: integer|null 223 Length of generator state. 224 225 stream.byteLength: integer|null 226 Size (in bytes) of generator state. 227 228 Examples 229 -------- 230 > function fcn( v ) { console.log( v ); }; 231 > var opts = { 'iter': 10 }; 232 > var s = {{alias}}.objectMode( opts ); 233 > var o = {{alias:@stdlib/streams/node/inspect-sink}}.objectMode( fcn ); 234 > s.pipe( o ); 235 236 See Also 237 -------- 238