(bias)
| 2499 | var _RANDOM_MAP = [90.0, 9.00, 4.00, 2.33, 1.50, 1.00, 0.66, 0.43, 0.25, 0.11, 0.01]; |
| 2500 | |
| 2501 | function _rndExp(bias) { |
| 2502 | if (bias === undefined) bias = 0.5; |
| 2503 | bias = Math.max(0, Math.min(bias, 1)) * 10; |
| 2504 | var i = parseInt(Math.floor(bias)); // bias*10 => index in the _map curve. |
| 2505 | var n = _RANDOM_MAP[i]; // If bias is 0.3, rnd()**2.33 will average 0.3. |
| 2506 | if (bias < 10) { |
| 2507 | n += (_RANDOM_MAP[i+1]-n) * (bias-i); |
| 2508 | } |
| 2509 | return n; |
| 2510 | } |
| 2511 | |
| 2512 | function random(v1, v2, bias) { |
| 2513 | /* Returns a number between v1 and v2, including v1 but not v2. |
no outgoing calls
no test coverage detected
searching dependent graphs…