repl.txt (4230B)
1 2 {{alias}}( a, b ) 3 Returns a pseudorandom number drawn from an arcsine distribution. 4 5 If `a >= b`, the function returns `NaN`. 6 7 If `a` or `b` is `NaN`, the function returns `NaN`. 8 9 Parameters 10 ---------- 11 a: number 12 Minimum support. 13 14 b: number 15 Maximum support. 16 17 Returns 18 ------- 19 r: number 20 Pseudorandom number. 21 22 Examples 23 -------- 24 > var r = {{alias}}( 2.0, 5.0 ) 25 <number> 26 27 28 {{alias}}.factory( [a, b, ][options] ) 29 Returns a pseudorandom number generator (PRNG) for generating pseudorandom 30 numbers drawn from an arcsine distribution. 31 32 If provided `a` and `b`, the returned PRNG returns random variates drawn 33 from the specified distribution. 34 35 If not provided `a` and `b`, the returned PRNG requires that both `a` and 36 `b` be provided at each invocation. 37 38 Parameters 39 ---------- 40 a: number (optional) 41 Minimum support. 42 43 b: number (optional) 44 Maximum support. 45 46 options: Object (optional) 47 Options. 48 49 options.prng: Function (optional) 50 Pseudorandom number generator (PRNG) for generating uniformly 51 distributed pseudorandom numbers on the interval `[0,1)`. If provided, 52 the `state` and `seed` options are ignored. In order to seed the 53 returned pseudorandom number generator, one must seed the provided 54 `prng` (assuming the provided `prng` is seedable). 55 56 options.seed: integer|ArrayLikeObject<integer> (optional) 57 Pseudorandom number generator seed. The seed may be either a positive 58 unsigned 32-bit integer or, for arbitrary length seeds, an array-like 59 object containing unsigned 32-bit integers. 60 61 options.state: Uint32Array (optional) 62 Pseudorandom number generator state. If provided, the `seed` option is 63 ignored. 64 65 options.copy: boolean (optional) 66 Boolean indicating whether to copy a provided pseudorandom number 67 generator state. Setting this option to `false` allows sharing state 68 between two or more pseudorandom number generators. Setting this option 69 to `true` ensures that a returned generator has exclusive control over 70 its internal state. Default: true. 71 72 Returns 73 ------- 74 rand: Function 75 Pseudorandom number generator (PRNG). 76 77 Examples 78 -------- 79 // Basic usage: 80 > var rand = {{alias}}.factory(); 81 > var r = rand( 0.0, 1.0 ) 82 <number> 83 > r = rand( -2.0, 2.0 ) 84 <number> 85 86 // Provide `a` and `b`: 87 > rand = {{alias}}.factory( 0.0, 1.0 ); 88 > r = rand() 89 <number> 90 > r = rand() 91 <number> 92 93 94 {{alias}}.NAME 95 Generator name. 96 97 Examples 98 -------- 99 > var str = {{alias}}.NAME 100 'arcsine' 101 102 103 {{alias}}.PRNG 104 Underlying pseudorandom number generator. 105 106 Examples 107 -------- 108 > var prng = {{alias}}.PRNG; 109 110 111 {{alias}}.seed 112 Pseudorandom number generator seed. 113 114 Examples 115 -------- 116 > var seed = {{alias}}.seed; 117 118 119 {{alias}}.seedLength 120 Length of generator seed. 121 122 Examples 123 -------- 124 > var len = {{alias}}.seedLength; 125 126 127 {{alias}}.state 128 Generator state. 129 130 Examples 131 -------- 132 > var r = {{alias}}( 2.0, 4.0 ) 133 <number> 134 > r = {{alias}}( 2.0, 4.0 ) 135 <number> 136 > r = {{alias}}( 2.0, 4.0 ) 137 <number> 138 139 // Get a copy of the current state: 140 > var state = {{alias}}.state 141 <Uint32Array> 142 143 > r = {{alias}}( 2.0, 4.0 ) 144 <number> 145 > r = {{alias}}( 2.0, 4.0 ) 146 <number> 147 148 // Set the state: 149 > {{alias}}.state = state; 150 151 // Replay the last two pseudorandom numbers: 152 > r = {{alias}}( 2.0, 4.0 ) 153 <number> 154 > r = {{alias}}( 2.0, 4.0 ) 155 <number> 156 157 158 {{alias}}.stateLength 159 Length of generator state. 160 161 Examples 162 -------- 163 > var len = {{alias}}.stateLength; 164 165 166 {{alias}}.byteLength 167 Size (in bytes) of generator state. 168 169 Examples 170 -------- 171 > var sz = {{alias}}.byteLength; 172 173 174 {{alias}}.toJSON() 175 Serializes the pseudorandom number generator as a JSON object. 176 177 Returns 178 ------- 179 out: Object 180 JSON representation. 181 182 Examples 183 -------- 184 > var o = {{alias}}.toJSON() 185 { 'type': 'PRNG', 'name': '...', 'state': {...}, 'params': [] } 186 187 See Also 188 -------- 189