repl.txt (8590B)
1 2 {{alias}}( [options] ) 3 Returns a readable stream for generating pseudorandom numbers drawn from a 4 standard normal distribution using the Improved Ziggurat algorithm. 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 Improved 96 Ziggurat algorithm. 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 Improved Ziggurat 162 algorithm. 163 164 Parameters 165 ---------- 166 options: Object (optional) 167 Options. 168 169 options.encoding: string|null (optional) 170 Specifies how Buffer objects should be decoded to strings. Default: 171 null. 172 173 options.highWaterMark: integer (optional) 174 Specifies the maximum number of objects to store in an internal buffer 175 before ceasing to generate additional pseudorandom numbers. 176 177 options.iter: integer (optional) 178 Number of iterations. 179 180 options.prng: Function (optional) 181 Pseudorandom number generator (PRNG) for generating uniformly 182 distributed pseudorandom numbers on the interval `[0,1)`. If provided, 183 the `state` and `seed` options are ignored. In order to seed the 184 returned iterator, one must seed the provided `prng` (assuming the 185 provided `prng` is seedable). 186 187 options.seed: integer|ArrayLikeObject<integer> (optional) 188 Pseudorandom number generator seed. The seed may be either a positive 189 unsigned 32-bit integer or, for arbitrary length seeds, an array-like 190 object containing unsigned 32-bit integers. 191 192 options.state: Uint32Array (optional) 193 Pseudorandom number generator state. If provided, the `seed` option is 194 ignored. 195 196 options.copy: boolean (optional) 197 Boolean indicating whether to copy a provided pseudorandom number 198 generator state. Setting this option to `false` allows sharing state 199 between two or more pseudorandom number generators. Setting this option 200 to `true` ensures that a returned iterator has exclusive control over 201 its internal state. Default: true. 202 203 options.siter: integer (optional) 204 Number of iterations after which to emit the PRNG state. Default: 1e308. 205 206 Returns 207 ------- 208 stream: ReadableStream 209 Readable stream operating in "objectMode". 210 211 stream.PRNG: Function 212 Underlying pseudorandom number generator. 213 214 stream.seed: Uint32Array|null 215 Pseudorandom number generator seed. 216 217 stream.seedLength: integer|null 218 Length of generator seed. 219 220 stream.state: Uint32Array|null 221 Generator state. 222 223 stream.stateLength: integer|null 224 Length of generator state. 225 226 stream.byteLength: integer|null 227 Size (in bytes) of generator state. 228 229 Examples 230 -------- 231 > function fcn( v ) { console.log( v ); }; 232 > var opts = { 'iter': 10 }; 233 > var s = {{alias}}.objectMode( opts ); 234 > var o = {{alias:@stdlib/streams/node/inspect-sink}}.objectMode( fcn ); 235 > s.pipe( o ); 236 237 See Also 238 -------- 239