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