1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
{{alias}}( iterator, sigma[, options] )
Returns an iterator which introduces additive white Gaussian noise (AWGN)
with standard deviation `sigma`.
If an environment supports Symbol.iterator and the provided iterator is
iterable, the returned iterator is iterable.
Parameters
----------
iterator: Object
Input iterator.
sigma: number
Standard deviation of the noise.
options: Object (optional)
Options.
options.prng: Function (optional)
Pseudorandom number generator (PRNG) for generating pseudorandom numbers
drawn from a standard normal distribution. If provided, the `state` and
`seed` options are ignored. In order to seed the returned iterator, one
must seed the provided `prng` (assuming the provided `prng` is
seedable).
options.seed: integer|ArrayLikeObject<integer> (optional)
Pseudorandom number generator seed. The seed may be either a positive
unsigned 32-bit integer or, for arbitrary length seeds, an array-like
object containing unsigned 32-bit integers.
options.state: Uint32Array (optional)
Pseudorandom number generator state. If provided, the `seed` option is
ignored.
options.copy: boolean (optional)
Boolean indicating whether to copy a provided pseudorandom number
generator state. Setting this option to `false` allows sharing state
between two or more pseudorandom number generators. Setting this option
to `true` ensures that a returned iterator has exclusive control over
its internal state. Default: true.
Returns
-------
iterator: Object
Iterator.
iterator.next(): Function
Returns an iterator protocol-compliant object containing the next
iterated value (if one exists) and a boolean flag indicating whether the
iterator is finished.
iterator.return( [value] ): Function
Finishes an iterator and returns a provided value.
iterator.PRNG: Function|null
Underlying pseudorandom number generator.
iterator.seed: Uint32Array|null
Pseudorandom number generator seed.
iterator.seedLength: integer|null
Length of generator seed.
iterator.state: Uint32Array|null
Pseudorandom random number generator state.
iterator.stateLength: integer|null
Length of generator state.
iterator.byteLength: integer|null
Size (in bytes) of generator state.
Examples
--------
> var src = {{alias:@stdlib/simulate/iter/sine-wave}}();
> var it = {{alias}}( src, 0.5 );
> var v = it.next().value
<number>
> v = it.next().value
<number>
See Also
--------
|