repl.txt (9729B)
1 2 {{alias}}( [options] ) 3 Returns a readable stream for generating pseudorandom numbers drawn from a 4 standard normal distribution. 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 default underlying pseudorandom number generator (PRNG) *may* change in 12 the future. If exact reproducibility is required, either explicitly specify 13 a PRNG via the `name` option or use an underlying PRNG directly. 14 15 Parameters 16 ---------- 17 options: Object (optional) 18 Options. 19 20 options.objectMode: boolean (optional) 21 Specifies whether a stream should operate in "objectMode". Default: 22 false. 23 24 options.encoding: string|null (optional) 25 Specifies how Buffer objects should be decoded to strings. Default: 26 null. 27 28 options.highWaterMark: integer (optional) 29 Specifies the maximum number of bytes to store in an internal buffer 30 before ceasing to generate additional pseudorandom numbers. 31 32 options.sep: string (optional) 33 Separator used to join streamed data. This option is only applicable 34 when a stream is not in "objectMode". Default: '\n'. 35 36 options.iter: integer (optional) 37 Number of iterations. 38 39 options.name: string (optional) 40 Name of a supported pseudorandom number generator (PRNG), which will 41 serve as the underlying source of pseudorandom numbers. The following 42 PRNGs are supported: 43 44 - improved-ziggurat: improved ziggurat method. 45 - box-muller: Box-Muller transform. 46 47 Default: 'improved-ziggurat'. 48 49 options.prng: Function (optional) 50 Pseudorandom number generator (PRNG) for generating uniformly 51 distributed pseudorandom numbers on the interval `[0,1)`. If provided, 52 the `state` and `seed` options are ignored. In order to seed the 53 returned iterator, one must seed the provided `prng` (assuming the 54 provided `prng` is seedable). 55 56 options.seed: integer|ArrayLikeObject<integer> (optional) 57 Pseudorandom number generator seed. The seed may be either a positive 58 unsigned 32-bit integer or, for arbitrary length seeds, an array-like 59 object containing unsigned 32-bit integers. 60 61 options.state: Uint32Array (optional) 62 Pseudorandom number generator state. If provided, the `seed` option is 63 ignored. 64 65 options.copy: boolean (optional) 66 Boolean indicating whether to copy a provided pseudorandom number 67 generator state. Setting this option to `false` allows sharing state 68 between two or more pseudorandom number generators. Setting this option 69 to `true` ensures that a returned iterator has exclusive control over 70 its internal state. Default: true. 71 72 options.siter: integer (optional) 73 Number of iterations after which to emit the PRNG state. Default: 1e308. 74 75 Returns 76 ------- 77 stream: ReadableStream 78 Readable stream. 79 80 stream.PRNG: Function 81 Underlying pseudorandom number generator. 82 83 stream.seed: Uint32Array|null 84 Pseudorandom number generator seed. 85 86 stream.seedLength: integer|null 87 Length of generator seed. 88 89 stream.state: Uint32Array|null 90 Generator state. 91 92 stream.stateLength: integer|null 93 Length of generator state. 94 95 stream.byteLength: integer|null 96 Size (in bytes) of generator state. 97 98 Examples 99 -------- 100 > function fcn( chunk ) { console.log( chunk.toString() ); }; 101 > var opts = { 'iter': 10 }; 102 > var s = {{alias}}( opts ); 103 > var o = {{alias:@stdlib/streams/node/inspect-sink}}( fcn ); 104 > s.pipe( o ); 105 106 107 {{alias}}.factory( [options] ) 108 Returns a function for creating readable streams which generate pseudorandom 109 numbers drawn from a standard normal distribution. 110 111 Parameters 112 ---------- 113 options.objectMode: boolean (optional) 114 Specifies whether a stream should operate in "objectMode". Default: 115 false. 116 117 options.encoding: string|null (optional) 118 Specifies how Buffer objects should be decoded to strings. Default: 119 null. 120 121 options.highWaterMark: integer (optional) 122 Specifies the maximum number of bytes to store in an internal buffer 123 before ceasing to generate additional pseudorandom numbers. 124 125 options.sep: string (optional) 126 Separator used to join streamed data. This option is only applicable 127 when a stream is not in "objectMode". Default: '\n'. 128 129 options.iter: integer (optional) 130 Number of iterations. 131 132 options.name: string (optional) 133 Name of a supported pseudorandom number generator (PRNG), which will 134 serve as the underlying source of pseudorandom numbers. The following 135 PRNGs are supported: 136 137 - improved-ziggurat: improved ziggurat method. 138 - box-muller: Box-Muller transform. 139 140 Default: 'improved-ziggurat'. 141 142 options.prng: Function (optional) 143 Pseudorandom number generator (PRNG) for generating uniformly 144 distributed pseudorandom numbers on the interval `[0,1)`. If provided, 145 the `state` and `seed` options are ignored. In order to seed the 146 returned iterator, one must seed the provided `prng` (assuming the 147 provided `prng` is seedable). 148 149 options.seed: integer|ArrayLikeObject<integer> (optional) 150 Pseudorandom number generator seed. The seed may be either a positive 151 unsigned 32-bit integer or, for arbitrary length seeds, an array-like 152 object containing unsigned 32-bit integers. 153 154 options.state: Uint32Array (optional) 155 Pseudorandom number generator state. If provided, the `seed` option is 156 ignored. 157 158 options.copy: boolean (optional) 159 Boolean indicating whether to copy a provided pseudorandom number 160 generator state. Setting this option to `false` allows sharing state 161 between two or more pseudorandom number generators. Setting this option 162 to `true` ensures that a returned iterator has exclusive control over 163 its internal state. Default: true. 164 165 options.siter: integer (optional) 166 Number of iterations after which to emit the PRNG state. Default: 1e308. 167 168 Returns 169 ------- 170 fcn: Function 171 Function for creating readable streams. 172 173 Examples 174 -------- 175 > var opts = { 'objectMode': true, 'highWaterMark': 64 }; 176 > var createStream = {{alias}}.factory( opts ); 177 178 179 {{alias}}.objectMode( [options] ) 180 Returns an "objectMode" readable stream for generating pseudorandom numbers 181 drawn from a standard normal distribution. 182 183 Parameters 184 ---------- 185 options: Object (optional) 186 Options. 187 188 options.encoding: string|null (optional) 189 Specifies how Buffer objects should be decoded to strings. Default: 190 null. 191 192 options.highWaterMark: integer (optional) 193 Specifies the maximum number of objects to store in an internal buffer 194 before ceasing to generate additional pseudorandom numbers. 195 196 options.iter: integer (optional) 197 Number of iterations. 198 199 options.name: string (optional) 200 Name of a supported pseudorandom number generator (PRNG), which will 201 serve as the underlying source of pseudorandom numbers. The following 202 PRNGs are supported: 203 204 - improved-ziggurat: improved ziggurat method. 205 - box-muller: Box-Muller transform. 206 207 Default: 'improved-ziggurat'. 208 209 options.prng: Function (optional) 210 Pseudorandom number generator (PRNG) for generating uniformly 211 distributed pseudorandom numbers on the interval `[0,1)`. If provided, 212 the `state` and `seed` options are ignored. In order to seed the 213 returned iterator, one must seed the provided `prng` (assuming the 214 provided `prng` is seedable). 215 216 options.seed: integer|ArrayLikeObject<integer> (optional) 217 Pseudorandom number generator seed. The seed may be either a positive 218 unsigned 32-bit integer or, for arbitrary length seeds, an array-like 219 object containing unsigned 32-bit integers. 220 221 options.state: Uint32Array (optional) 222 Pseudorandom number generator state. If provided, the `seed` option is 223 ignored. 224 225 options.copy: boolean (optional) 226 Boolean indicating whether to copy a provided pseudorandom number 227 generator state. Setting this option to `false` allows sharing state 228 between two or more pseudorandom number generators. Setting this option 229 to `true` ensures that a returned iterator has exclusive control over 230 its internal state. Default: true. 231 232 options.siter: integer (optional) 233 Number of iterations after which to emit the PRNG state. Default: 1e308. 234 235 Returns 236 ------- 237 stream: ReadableStream 238 Readable stream operating in "objectMode". 239 240 stream.PRNG: Function 241 Underlying pseudorandom number generator. 242 243 stream.seed: Uint32Array|null 244 Pseudorandom number generator seed. 245 246 stream.seedLength: integer|null 247 Length of generator seed. 248 249 stream.state: Uint32Array|null 250 Generator state. 251 252 stream.stateLength: integer|null 253 Length of generator state. 254 255 stream.byteLength: integer|null 256 Size (in bytes) of generator state. 257 258 Examples 259 -------- 260 > function fcn( v ) { console.log( v ); }; 261 > var opts = { 'iter': 10 }; 262 > var s = {{alias}}.objectMode( opts ); 263 > var o = {{alias:@stdlib/streams/node/inspect-sink}}.objectMode( fcn ); 264 > s.pipe( o ); 265 266 See Also 267 -------- 268