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