repl.txt (3131B)
1 2 {{alias}}( [options] ) 3 Create an iterator for generating pseudorandom numbers drawn from a standard 4 normal distribution. 5 6 The default underlying pseudorandom number generator (PRNG) *may* change in 7 the future. If exact reproducibility is required, either explicitly specify 8 a PRNG via the `name` option or use an underlying PRNG directly. 9 10 If an environment supports Symbol.iterator, the returned iterator is 11 iterable. 12 13 Parameters 14 ---------- 15 options: Object (optional) 16 Options. 17 18 options.name: string (optional) 19 Name of a supported pseudorandom number generator (PRNG), which will 20 serve as the underlying source of pseudorandom numbers. The following 21 PRNGs are supported: 22 23 - improved-ziggurat: improved ziggurat method. 24 - box-muller: Box-Muller transform. 25 26 Default: `'improved-ziggurat'`. 27 28 options.prng: Function (optional) 29 Pseudorandom number generator (PRNG) for generating uniformly 30 distributed pseudorandom numbers on the interval `[0,1)`. If provided, 31 the `state` and `seed` options are ignored. In order to seed the 32 returned iterator, one must seed the provided `prng` (assuming the 33 provided `prng` is seedable). 34 35 options.seed: integer|ArrayLikeObject<integer> (optional) 36 Pseudorandom number generator seed. The seed may be either a positive 37 unsigned 32-bit integer or, for arbitrary length seeds, an array-like 38 object containing unsigned 32-bit integers. 39 40 options.state: Uint32Array (optional) 41 Pseudorandom number generator state. If provided, the `seed` option is 42 ignored. 43 44 options.copy: boolean (optional) 45 Boolean indicating whether to copy a provided pseudorandom number 46 generator state. Setting this option to `false` allows sharing state 47 between two or more pseudorandom number generators. Setting this option 48 to `true` ensures that a returned iterator has exclusive control over 49 its internal state. Default: true. 50 51 options.iter: integer (optional) 52 Number of iterations. 53 54 Returns 55 ------- 56 iterator: Object 57 Iterator. 58 59 iterator.next(): Function 60 Returns an iterator protocol-compliant object containing the next 61 iterated value (if one exists) and a boolean flag indicating whether the 62 iterator is finished. 63 64 iterator.return( [value] ): Function 65 Finishes an iterator and returns a provided value. 66 67 iterator.PRNG: Function 68 Underlying pseudorandom number generator. 69 70 iterator.seed: Uint32Array|null 71 Pseudorandom number generator seed. 72 73 iterator.seedLength: integer|null 74 Length of generator seed. 75 76 iterator.state: Uint32Array|null 77 Generator state. 78 79 iterator.stateLength: integer|null 80 Length of generator state. 81 82 iterator.byteLength: integer|null 83 Size (in bytes) of generator state. 84 85 Examples 86 -------- 87 > var it = {{alias}}(); 88 > var r = it.next().value 89 <number> 90 > r = it.next().value 91 <number> 92 93 See Also 94 -------- 95